File: test-post-multifrom

package info (click to toggle)
nmh 1.8-4
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 7,860 kB
  • sloc: ansic: 50,445; sh: 22,697; makefile: 1,138; lex: 740; perl: 509; yacc: 265
file content (55 lines) | stat: -rwxr-xr-x 1,314 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
#
# Test the behavior of post with multiple from addresses
#

set -e

if test -z "${MH_OBJ_DIR}"; then
    srcdir=`dirname "$0"`/../..
    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
fi

. "${srcdir}/test/post/test-post-common.sh"

#
# This SHOULD error
#

cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
From: Mr Nobody One <nobody1@example.com>, Mr Nobody Two <nobody2@example.com>
To: Somebody Else <somebody@example.com>
Subject: Test multi-from

This is a test of multi-from.
EOF

#
# Since this should fail, don't run fakesmtp
#

run_test "send -draft -server 127.0.0.1 -port $localport" \
	"post: A Sender: or Envelope-From: header is required with multiple
From: addresses
post: re-format message and try again
send: message not delivered to anyone"

#
# This should also error
#
cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
From: Mr Nobody One <nobody1@example.com>, Mr Nobody Two <nobody2@example.com>
To: Somebody Else <somebody@example.com>
Subject: Test multi-from
Envelope-From:

This is a test of multi-from with blank Envelope-From.
EOF

run_test "send -draft -server 127.0.0.1 -port $localport" \
	"post: Envelope-From cannot be blank when there is multiple From: addresses
and no Sender: header
post: re-format message and try again
send: message not delivered to anyone"

exit ${failed:-0}