]>
diplodocus.org Git - nmh/blob - test/post/test-post-aliases
2 ######################################################
4 # Test aliases all the way through post
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname "$0"`/..
/..
12 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
15 .
"${srcdir}/test/post/test-post-common.sh"
17 # Note that the last address in the blind list does not end with a
19 cat >"${MH_TEST_DIR}/Mail/aliases" <<EOF
20 blind_list: Blind List: one, two, three
21 named.list; one@example.com, two@example.com
24 three: three@example.com
27 #### Rely on sendmail/smtp or sendmail/pipe below to override default mts.
28 mts_fakesendmail
="${MHMTSCONF}-fakesendmail"
29 cp "${MHMTSCONF}" "$mts_fakesendmail"
30 printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
31 MHMTSCONF
="$mts_fakesendmail"
33 # $1: -mts switch selection
37 if [ "$1" = 'sendmail/smtp' ]; then
38 run_prog send
-draft -alias "${MH_TEST_DIR}/Mail/aliases" -mts sendmail
/smtp
40 # fakesendmail drops the message and any cc's into this mbox.
41 mbox
="${MH_TEST_DIR}"/Mail
/fakesendmail.mbox
42 inc
-silent -file "$mbox"
43 rm -f "$mbox" "$mbox.map"
45 # It's hard to calculate the exact Date: header post is going to
46 # use, so we'll just use sed to remove the actual date so we can easily
47 # compare it against our "correct" output.
48 sed -e 's/^Date:.*/Date:/' "`mhpath cur`" >"${testname}.actual"
50 check
"${testname}.actual" "$2"
52 if [ "`mhpath cur`" != "`mhpath last`" ]; then
53 folder next
>/dev
/null
54 arith_eval
$n + 1; n
=$arith_val
57 elif [ "$1" = 'sendmail/pipe' ]; then
59 run_prog send
-draft -alias "${MH_TEST_DIR}/Mail/aliases" \
60 -mts sendmail
/pipe
>"${testname}.actual" 2>&1
62 printf '%s: sendmail/pipe should have failed but didn'"'"'t\n' "$0"
65 check
"${testname}.actual" "$2"
69 printf '%s: invalid -mts switch selection\n' "$0"
76 cat >"${MH_TEST_DIR}/Mail/draft" <<EOF
77 From: Mr Nobody <nobody@example.com>
79 Subject: blind list test
81 This is test of a blind list.
83 cp -p "${MH_TEST_DIR}/Mail/draft" "${MH_TEST_DIR}/Mail/draft2"
85 cat >"${testname}.expected" <<EOF
86 From: Mr Nobody <nobody@example.com>
88 Subject: blind list test
90 Content-Type: text/plain; charset="us-ascii"
93 This is test of a blind list.
96 test_alias sendmail
/smtp
"${testname}.expected"
98 # Make sure the addresses were expanded correctly.
99 mv "${MH_TEST_DIR}/Mail/draft2" "${MH_TEST_DIR}/Mail/draft"
101 cat > "${testname}.expected" <<EOF
102 EHLO nosuchhost.example.com
103 MAIL FROM:<nobody@example.com>
104 RCPT TO:<one@example.com>
105 RCPT TO:<two@example.com>
106 RCPT TO:<three@example.com>
108 From: Mr Nobody <nobody@example.com>
110 Subject: blind list test
112 Content-Type: text/plain; charset="us-ascii"
115 This is test of a blind list.
120 test_post
"${testname}.actual" "${testname}.expected" \
121 "-alias ${MH_TEST_DIR}/Mail/aliases"
123 # check named list (alias followed by ;)
124 cat >"${MH_TEST_DIR}/Mail/draft" <<EOF
125 From: Mr Nobody <nobody@example.com>
127 Subject: named list test
129 This is test of a named list.
132 cat >"${testname}.expected" <<EOF
133 From: Mr Nobody <nobody@example.com>
134 To: "named.list" <one@example.com>, "named.list" <two@example.com>
135 Subject: named list test
137 Content-Type: text/plain; charset="us-ascii"
140 This is test of a named list.
143 test_alias sendmail
/smtp
"${testname}.expected"
145 # check blind list with -mts sendmail/pipe, which should fail
146 cat >"${MH_TEST_DIR}/Mail/draft" <<EOF
147 From: Mr Nobody <nobody@example.com>
149 Subject: blind list test
151 This is test of a blind list.
154 cat >"${testname}.expected" <<EOF
155 post: blind lists not compatible with sendmail/pipe
156 send: message not delivered to anyone
159 test_alias sendmail
/pipe
"${testname}.expected"