aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/multipart
blob: ef9a8a2ec2b9bba8cc581c7fa563f091134d038f (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
test_description="output of multipart message"
. ./test-lib.sh

cat <<EOF > ${MAIL_DIR}/multipart
From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org
Subject: Multipart message
Date: Tue, 05 Jan 2001 15:43:57 -0000
User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu)
Message-ID: <87liy5ap00.fsf@yoom.home.cworth.org>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="==-=-=";
	micalg=pgp-sha1; protocol="application/pgp-signature"

--==-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=

This is an inline text part.

--=-=-=
Content-Disposition: attachment; filename=attachment

This is a text attachment.

--=-=-=

And this message is signed.

-Carl

--=-=-=--

--==-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk3SA/gACgkQ6JDdNq8qSWj0sACghqVJEQJUs3yV8zbTzhgnSIcD
W6cAmQE4dcYrx/LPLtYLZm1jsGauE5hE
=zkga
-----END PGP SIGNATURE-----
--==-=-=--
EOF
notmuch new > /dev/null

test_begin_subtest "Show multipart MIME message (--format=text)"
output=$(notmuch show --format=text 'id:87liy5ap00.fsf@yoom.home.cworth.org')
test_expect_equal "$output" "message{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 filename:/home/cworth/src/notmuch/test/tmp.multipart/mail/multipart
header{
Carl Worth <cworth@cworth.org> (2001-01-05) (attachment inbox unread)
Subject: Multipart message
From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org
Date: Tue, 05 Jan 2001 15:43:57 -0000
header}
body{
part{ ID: 1, Content-type: multipart/signed
part}
part{ ID: 2, Content-type: multipart/mixed
part}
part{ ID: 3, Content-type: text/plain
This is an inline text part.
part}
attachment{ ID: 4, Content-type: text/plain
Attachment: attachment (text/plain)
This is a text attachment.
attachment}
part{ ID: 5, Content-type: text/plain
And this message is signed.

-Carl
part}
part{ ID: 6, Content-type: application/pgp-signature
Non-text part: application/pgp-signature
part}
body}
message}"

test_begin_subtest "Show multipart MIME message (--format=json)"
output=$(notmuch show --format=json 'id:87liy5ap00.fsf@yoom.home.cworth.org')
test_expect_equal "$output" '[[[{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "/home/cworth/src/notmuch/test/tmp.multipart/mail/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"}, {"id": 2, "content-type": "multipart/mixed"}, {"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"}]}, []]]]'

test_done