]>
diplodocus.org Git - nmh/blob - test/mhbuild/test-attach
2 ######################################################
4 # Test the use of the Attach: header
6 ######################################################
8 if test -z "${MH_OBJ_DIR}"; then
9 srcdir
=`dirname "$0"`/..
/..
10 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
13 .
"$MH_OBJ_DIR/test/common.sh"
17 draft
="$MH_TEST_DIR/$$.draft"
18 expected
="$MH_TEST_DIR/$$.expected"
21 # Test out a simple draft, one part.
25 To: Mr Test <mrtest@example.com>
28 Attach: ${srcdir}/test/mhbuild/tiny.jpg
32 run_prog mhbuild
"$draft"
34 cat > "$expected" <<EOF
35 To: Mr Test <mrtest@example.com>
39 Content-Type: image/jpeg; name="tiny.jpg"
40 Content-Description: tiny.jpg
41 Content-Disposition: attachment; filename="tiny.jpg"
42 Content-Transfer-Encoding: base64
47 check
"$draft" "$expected"
50 # Check out more common case, one (or more) attachments
51 # along with message text.
55 To: Mr Test <mrtest@example.com>
58 Attach: ${srcdir}/test/mhbuild/tiny.jpg
63 run_prog mhbuild
"$draft"
65 cat > "$expected" <<EOF
66 To: Mr Test <mrtest@example.com>
70 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
73 Content-Type: text/plain; charset="us-ascii"
78 Content-Type: image/jpeg; name="tiny.jpg"
79 Content-Description: tiny.jpg
80 Content-Disposition: attachment; filename="tiny.jpg"
81 Content-Transfer-Encoding: base64
85 ------- =_aaaaaaaaaa0--
88 check
"$draft" "$expected"
91 # An empty Attach header
95 To: Mr Test <mrtest@example.com>
100 This is a test of an empty attach header.
103 run_prog mhbuild
"$draft"
105 cat > "$expected" <<EOF
106 To: Mr Test <mrtest@example.com>
110 Content-Type: text/plain; charset="us-ascii"
112 This is a test of an empty attach header.
115 check
"$draft" "$expected"
118 # Check a completely empty message
122 To: Mr Test <mrtest@example.com>
125 Subject: Test of an empty body
128 run_prog mhbuild
"$draft"
130 cat > "$expected" <<EOF
131 To: Mr Test <mrtest@example.com>
134 Subject: Test of an empty body
136 Content-Type: text/plain
139 check
"$draft" "$expected"
142 # Make sure we fail if we run into a MIME-Version header
146 To: Mr Test <mrtest@example.com>
149 Subject: Test of an already-MIMEified message
151 Content-Type: text/plain; charset="us-ascii"
153 This is a preformatted MIME content test.
157 run_test
'eval mhbuild "$draft"' "mhbuild: draft shouldn't contain MIME-Version: field"
161 # Run it again using -auto
164 run_prog mhbuild
-auto "$draft"
166 cat > "$expected" <<EOF
167 To: Mr Test <mrtest@example.com>
170 Subject: Test of an already-MIMEified message
172 Content-Type: text/plain; charset="us-ascii"
174 This is a preformatted MIME content test.
177 check
"$draft" "$expected"
180 # Make sure -dist does nothing but encode headers
184 To: Señor Test <mrtest@example.com>
187 Subject: An empty dist test
190 LC_ALL
=en_US.UTF
-8 run_prog mhbuild
-dist "$draft"
192 cat > "$expected" <<EOF
193 To: =?UTF-8?Q?Se=C3=B1or_Test?= <mrtest@example.com>
196 Subject: An empty dist test
199 check
"$draft" "$expected"
202 # Two parts, one attachment; make sure mixing of multiparts at different
207 To: Mr Test <mrtest@example.com>
210 Subject: A more complete multipart test
211 Attach: ${srcdir}/test/mhbuild/tiny.jpg
219 This is some HTML tëxt.
225 LC_ALL
=en_US.UTF
-8 run_prog mhbuild
"$draft"
227 cat > "$expected" <<EOF
228 To: Mr Test <mrtest@example.com>
231 Subject: A more complete multipart test
233 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
235 ------- =_aaaaaaaaaa0
236 Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1"
238 ------- =_aaaaaaaaaa1
239 Content-Type: text/plain; charset="UTF-8"
240 Content-Transfer-Encoding: quoted-printable
242 This is some t=C3=ABxt.
244 ------- =_aaaaaaaaaa1
245 Content-Type: text/html; charset="UTF-8"
246 Content-Transfer-Encoding: quoted-printable
250 This is some HTML t=C3=ABxt.
254 ------- =_aaaaaaaaaa1--
256 ------- =_aaaaaaaaaa0
257 Content-Type: image/jpeg; name="tiny.jpg"
258 Content-Description: tiny.jpg
259 Content-Disposition: attachment; filename="tiny.jpg"
260 Content-Transfer-Encoding: base64
264 ------- =_aaaaaaaaaa0--
267 check
"$draft" "$expected"