2 test_description="output of multipart message"
5 cat <<EOF > ${MAIL_DIR}/multipart
6 From: Carl Worth <cworth@cworth.org>
8 Subject: Multipart message
9 Date: Tue, 05 Jan 2001 15:43:57 -0000
10 User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu)
11 Message-ID: <87liy5ap00.fsf@yoom.home.cworth.org>
13 Content-Type: multipart/signed; boundary="==-=-=";
14 micalg=pgp-sha1; protocol="application/pgp-signature"
17 Content-Type: multipart/mixed; boundary="=-=-="
21 This is an inline text part.
24 Content-Disposition: attachment; filename=attachment
26 This is a text attachment.
30 And this message is signed.
37 Content-Type: application/pgp-signature
39 -----BEGIN PGP SIGNATURE-----
40 Version: GnuPG v1.4.11 (GNU/Linux)
42 iEYEARECAAYFAk3SA/gACgkQ6JDdNq8qSWj0sACghqVJEQJUs3yV8zbTzhgnSIcD
43 W6cAmQE4dcYrx/LPLtYLZm1jsGauE5hE
45 -----END PGP SIGNATURE-----
48 notmuch new > /dev/null
50 test_begin_subtest "Show multipart MIME message (--format=text)"
51 output=$(notmuch show --format=text 'id:87liy5ap00.fsf@yoom.home.cworth.org')
52 test_expect_equal "$output" "
\fmessage{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 filename:${MAIL_DIR}/multipart
54 Carl Worth <cworth@cworth.org> (2001-01-05) (attachment inbox unread)
55 Subject: Multipart message
56 From: Carl Worth <cworth@cworth.org>
58 Date: Tue, 05 Jan 2001 15:43:57 -0000
61 \fpart{ ID: 1, Content-type: multipart/signed
62 \fpart{ ID: 2, Content-type: multipart/mixed
63 \fpart{ ID: 3, Content-type: text/plain
64 This is an inline text part.
66 \fattachment{ ID: 4, Content-type: text/plain
67 Attachment: attachment (text/plain)
68 This is a text attachment.
70 \fpart{ ID: 5, Content-type: text/plain
71 And this message is signed.
76 \fpart{ ID: 6, Content-type: application/pgp-signature
77 Non-text part: application/pgp-signature
83 test_begin_subtest "Show multipart MIME message (--format=json)"
84 output=$(notmuch show --format=json 'id:87liy5ap00.fsf@yoom.home.cworth.org')
85 test_expect_equal "$output" '[[[{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "'"${MAIL_DIR}"'/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Cc": "", "Bcc": "", "Date": "Tue, 05 Jan 2001 15:43:57 -0000"}, "body": [{"id": 1, "content-type": "multipart/signed", "content": [{"id": 2, "content-type": "multipart/mixed", "content": [{"id": 3, "content-type": "text/plain", "content": "This is an inline text part.\n"}, {"id": 4, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, {"id": 5, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, {"id": 6, "content-type": "application/pgp-signature"}]}]}, []]]]'