1 Return-Path: <jrollins@servo.finestructure.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id D6C7A429E34
\r
6 for <notmuch@notmuchmail.org>; Sun, 5 Jun 2011 17:29:54 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5
\r
12 tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3]
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id hxUpCsVjKePr for <notmuch@notmuchmail.org>;
\r
17 Sun, 5 Jun 2011 17:29:47 -0700 (PDT)
\r
18 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu
\r
20 by olra.theworths.org (Postfix) with ESMTP id 949E9431FB6
\r
21 for <notmuch@notmuchmail.org>; Sun, 5 Jun 2011 17:29:41 -0700 (PDT)
\r
22 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])
\r
23 by fire-doxen-postvirus (Postfix) with ESMTP id CE54D3280D8;
\r
24 Sun, 5 Jun 2011 17:22:38 -0700 (PDT)
\r
25 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new
\r
26 Received: from servo.finestructure.net (cpe-98-149-172-122.socal.res.rr.com
\r
27 [98.149.172.122]) (Authenticated sender: jrollins)
\r
28 by fire-doxen-submit (Postfix) with ESMTP id A5B383280DA;
\r
29 Sun, 5 Jun 2011 17:22:29 -0700 (PDT)
\r
30 Received: by servo.finestructure.net (Postfix, from userid 1000)
\r
31 id 20E5121D; Sun, 5 Jun 2011 17:29:31 -0700 (PDT)
\r
32 From: Jameson Graef Rollins <jrollins@finestructure.net>
\r
33 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
34 Subject: [PATCH 3/5] test: overhaul multipart test to test for improved
\r
35 message/rfc822 handling
\r
36 Date: Sun, 5 Jun 2011 17:29:27 -0700
\r
37 Message-Id: <1307320169-29905-4-git-send-email-jrollins@finestructure.net>
\r
38 X-Mailer: git-send-email 1.7.4.4
\r
39 In-Reply-To: <1307320169-29905-3-git-send-email-jrollins@finestructure.net>
\r
40 References: <87sjrsi2b4.fsf@servo.factory.finestructure.net>
\r
41 <1307320169-29905-1-git-send-email-jrollins@finestructure.net>
\r
42 <1307320169-29905-2-git-send-email-jrollins@finestructure.net>
\r
43 <1307320169-29905-3-git-send-email-jrollins@finestructure.net>
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Mon, 06 Jun 2011 00:29:55 -0000
\r
58 The main goal of this overhaul is to define how message/rfc822 parts
\r
59 should be handled. message/rfc822 parts should be output in a similar
\r
60 fashion to the outer message, including some subset of the rfc822
\r
61 headers. The following decisions about formatting of message/rfc822
\r
64 The format and content of message/rfc822 parts shall be as similar as
\r
65 possible to that of full messages. In particular, for formatted
\r
66 outputs, the "content" of rfc822 part output should include "headers"
\r
69 The "body" field shall include the body of the message.
\r
71 The "headers" field shall include the following headers, since these
\r
72 are the ones available from the GMimeMessage:
\r
80 However, for the case of --format=raw the raw rfc822 should be output,
\r
81 including all headers.
\r
83 A subset of relevant headers shall be output in reply.
\r
85 The test embedded rfc822 message is also modified to be itself
\r
86 multipart, so we can more fully test how all sub parts of the message
\r
89 test/multipart | 368 +++++++++++++++++++++++++++++++++++++++++++-------------
\r
90 1 files changed, 283 insertions(+), 85 deletions(-)
\r
92 diff --git a/test/multipart b/test/multipart
\r
93 index 67e04d9..95577dc 100755
\r
94 --- a/test/multipart
\r
95 +++ b/test/multipart
\r
97 test_description="output of multipart message"
\r
100 +cat <<EOF > embedded_message
\r
101 +From: Carl Worth <cworth@cworth.org>
\r
102 +To: cworth@cworth.org
\r
103 +Subject: html message
\r
104 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
105 +User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu)
\r
106 +Message-ID: <87liy5ap01.fsf@yoom.home.cworth.org>
\r
108 +Content-Type: multipart/alternative; boundary="==-=-=="
\r
111 +Content-Type: text/html
\r
113 +<p>This is an embedded message, with a multipart/alternative part.</p>
\r
116 +Content-Type: text/plain
\r
118 +This is an embedded message, with a multipart/alternative part.
\r
123 cat <<EOF > ${MAIL_DIR}/multipart
\r
124 From: Carl Worth <cworth@cworth.org>
\r
125 To: cworth@cworth.org
\r
126 @@ -20,17 +43,9 @@ Content-Type: multipart/mixed; boundary="=-=-="
\r
127 Content-Type: message/rfc822
\r
128 Content-Disposition: inline
\r
130 -From: Carl Worth <cworth@cworth.org>
\r
131 -To: cworth@cworth.org
\r
132 -Subject: html message
\r
133 -Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
134 -User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu)
\r
135 -Message-ID: <87liy5ap01.fsf@yoom.home.cworth.org>
\r
137 -Content-Type: text/html
\r
139 -<p>This is an embedded message, with a single html part.</p>
\r
142 +cat embedded_message >> ${MAIL_DIR}/multipart
\r
143 +cat <<EOF >> ${MAIL_DIR}/multipart
\r
145 Content-Disposition: attachment; filename=attachment
\r
147 @@ -106,21 +121,34 @@ Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
149 part{ ID: 1, Content-type: multipart/signed
\r
151 part{ ID: 2, Content-type: multipart/mixed
\r
153 part{ ID: 3, Content-type: message/rfc822
\r
155 part{ ID: 4, Content-type: text/html
\r
158 +From: Carl Worth <cworth@cworth.org>
\r
159 +To: cworth@cworth.org
\r
160 +Subject: html message
\r
161 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
167 part{ ID: 4, Content-type: multipart/alternative
\r
169 part{ ID: 5, Content-type: text/html
\r
170 Non-text part: text/html
\r
174 part{ ID: 6, Content-type: text/plain
\r
175 +This is an embedded message, with a multipart/alternative part.
\r
185 attachment{ ID: 5, Content-type: text/plain
\r
187 attachment{ ID: 7, Content-type: text/plain
\r
188 Attachment: attachment (text/plain)
\r
189 This is a text attachment.
\r
193 part{ ID: 6, Content-type: text/plain
\r
195 part{ ID: 8, Content-type: text/plain
\r
196 And this message is signed.
\r
204 part{ ID: 7, Content-type: application/pgp-signature
\r
206 part{ ID: 9, Content-type: application/pgp-signature
\r
207 Non-text part: application/pgp-signature
\r
212 @@ -135,21 +163,34 @@ cat <<EOF >EXPECTED
\r
214 part{ ID: 1, Content-type: multipart/signed
\r
216 part{ ID: 2, Content-type: multipart/mixed
\r
218 part{ ID: 3, Content-type: message/rfc822
\r
220 part{ ID: 4, Content-type: text/html
\r
223 +From: Carl Worth <cworth@cworth.org>
\r
224 +To: cworth@cworth.org
\r
225 +Subject: html message
\r
226 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
232 part{ ID: 4, Content-type: multipart/alternative
\r
234 part{ ID: 5, Content-type: text/html
\r
235 Non-text part: text/html
\r
239 part{ ID: 6, Content-type: text/plain
\r
240 +This is an embedded message, with a multipart/alternative part.
\r
246 attachment{ ID: 5, Content-type: text/plain
\r
252 attachment{ ID: 7, Content-type: text/plain
\r
253 Attachment: attachment (text/plain)
\r
254 This is a text attachment.
\r
258 part{ ID: 6, Content-type: text/plain
\r
260 part{ ID: 8, Content-type: text/plain
\r
261 And this message is signed.
\r
269 part{ ID: 7, Content-type: application/pgp-signature
\r
271 part{ ID: 9, Content-type: application/pgp-signature
\r
272 Non-text part: application/pgp-signature
\r
277 @@ -161,15 +202,28 @@ notmuch show --format=text --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OU
\r
278 cat <<EOF >EXPECTED
\r
280 part{ ID: 2, Content-type: multipart/mixed
\r
282 part{ ID: 3, Content-type: message/rfc822
\r
284 part{ ID: 4, Content-type: text/html
\r
287 +From: Carl Worth <cworth@cworth.org>
\r
288 +To: cworth@cworth.org
\r
289 +Subject: html message
\r
290 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
296 part{ ID: 4, Content-type: multipart/alternative
\r
298 part{ ID: 5, Content-type: text/html
\r
299 Non-text part: text/html
\r
303 part{ ID: 6, Content-type: text/plain
\r
304 +This is an embedded message, with a multipart/alternative part.
\r
310 attachment{ ID: 5, Content-type: text/plain
\r
316 attachment{ ID: 7, Content-type: text/plain
\r
317 Attachment: attachment (text/plain)
\r
318 This is a text attachment.
\r
322 part{ ID: 6, Content-type: text/plain
\r
324 part{ ID: 8, Content-type: text/plain
\r
325 And this message is signed.
\r
328 @@ -178,40 +232,76 @@ And this message is signed.
\r
330 test_expect_equal_file OUTPUT EXPECTED
\r
332 -test_begin_subtest "--format=text --part=3, rfc822 multipart"
\r
333 +test_begin_subtest "--format=text --part=3, rfc822 part"
\r
334 notmuch show --format=text --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
335 cat <<EOF >EXPECTED
\r
337 part{ ID: 3, Content-type: message/rfc822
\r
339 part{ ID: 4, Content-type: text/html
\r
342 +From: Carl Worth <cworth@cworth.org>
\r
343 +To: cworth@cworth.org
\r
344 +Subject: html message
\r
345 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
351 part{ ID: 4, Content-type: multipart/alternative
\r
353 part{ ID: 5, Content-type: text/html
\r
354 Non-text part: text/html
\r
358 part{ ID: 6, Content-type: text/plain
\r
359 +This is an embedded message, with a multipart/alternative part.
\r
369 test_expect_equal_file OUTPUT EXPECTED
\r
371 -test_begin_subtest "--format=text --part=4, html part"
\r
372 +test_begin_subtest "--format=text --part=4, rfc822's multipart"
\r
373 notmuch show --format=text --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
374 cat <<EOF >EXPECTED
\r
376 part{ ID: 4, Content-type: text/html
\r
378 part{ ID: 4, Content-type: multipart/alternative
\r
380 part{ ID: 5, Content-type: text/html
\r
381 Non-text part: text/html
\r
385 part{ ID: 6, Content-type: text/plain
\r
386 +This is an embedded message, with a multipart/alternative part.
\r
392 test_expect_equal_file OUTPUT EXPECTED
\r
394 -test_begin_subtest "--format=text --part=5, inline attachement"
\r
395 +test_begin_subtest "--format=text --part=5, rfc822's html part"
\r
396 notmuch show --format=text --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
397 cat <<EOF >EXPECTED
\r
399 attachment{ ID: 5, Content-type: text/plain
\r
401 part{ ID: 5, Content-type: text/html
\r
402 +Non-text part: text/html
\r
406 +test_expect_equal_file OUTPUT EXPECTED
\r
408 +test_begin_subtest "--format=text --part=6, rfc822's text part"
\r
409 +notmuch show --format=text --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
410 +cat <<EOF >EXPECTED
\r
412 part{ ID: 6, Content-type: text/plain
\r
413 +This is an embedded message, with a multipart/alternative part.
\r
417 +test_expect_equal_file OUTPUT EXPECTED
\r
419 +test_begin_subtest "--format=text --part=7, inline attachement"
\r
420 +notmuch show --format=text --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
421 +cat <<EOF >EXPECTED
\r
423 attachment{ ID: 7, Content-type: text/plain
\r
424 Attachment: attachment (text/plain)
\r
425 This is a text attachment.
\r
429 test_expect_equal_file OUTPUT EXPECTED
\r
431 -test_begin_subtest "--format=text --part=6, plain text part"
\r
432 -notmuch show --format=text --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
433 +test_begin_subtest "--format=text --part=8, plain text part"
\r
434 +notmuch show --format=text --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
435 cat <<EOF >EXPECTED
\r
437 part{ ID: 6, Content-type: text/plain
\r
439 part{ ID: 8, Content-type: text/plain
\r
440 And this message is signed.
\r
443 @@ -219,10 +309,10 @@ And this message is signed.
\r
445 test_expect_equal_file OUTPUT EXPECTED
\r
447 -test_begin_subtest "--format=text --part=7, pgp signature (unverified)"
\r
448 -notmuch show --format=text --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
449 +test_begin_subtest "--format=text --part=9, pgp signature (unverified)"
\r
450 +notmuch show --format=text --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
451 cat <<EOF >EXPECTED
\r
453 part{ ID: 7, Content-type: application/pgp-signature
\r
455 part{ ID: 9, Content-type: application/pgp-signature
\r
456 Non-text part: application/pgp-signature
\r
460 @@ -233,48 +323,126 @@ test_expect_success \
\r
461 "notmuch show --format=text --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'"
\r
463 test_begin_subtest "--format=json --part=0, full message"
\r
464 -output=$(notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
465 -test_expect_equal "$output" \
\r
466 -'{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "'"${MAIL_DIR}/multipart"'", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Cc": "", "Bcc": "", "Date": "Fri, 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": "message/rfc822", "content": [{"id": 4, "content-type": "text/html"}]}, {"id": 5, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, {"id": 6, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, {"id": 7, "content-type": "application/pgp-signature"}]}]}'
\r
467 +notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
468 +echo >>OUTPUT # expect *no* newline at end of output
\r
469 +cat <<EOF >EXPECTED
\r
471 +{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Cc": "", "Bcc": "", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [
\r
472 +{"id": 1, "content-type": "multipart/signed", "content": [
\r
473 +{"id": 2, "content-type": "multipart/mixed", "content": [
\r
474 +{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Subject": "html message", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [
\r
475 +{"id": 4, "content-type": "multipart/alternative", "content": [
\r
476 +{"id": 5, "content-type": "text/html"},
\r
477 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]},
\r
478 +{"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"},
\r
479 +{"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]},
\r
480 +{"id": 9, "content-type": "application/pgp-signature"}]}]}
\r
482 +test_expect_equal_file OUTPUT EXPECTED
\r
484 test_begin_subtest "--format=json --part=1, message body"
\r
485 -output=$(notmuch show --format=json --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
486 -test_expect_equal "$output" \
\r
487 -'{"id": 1, "content-type": "multipart/signed", "content": [{"id": 2, "content-type": "multipart/mixed", "content": [{"id": 3, "content-type": "message/rfc822", "content": [{"id": 4, "content-type": "text/html"}]}, {"id": 5, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, {"id": 6, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, {"id": 7, "content-type": "application/pgp-signature"}]}'
\r
488 +notmuch show --format=json --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
489 +echo >>OUTPUT # expect *no* newline at end of output
\r
490 +cat <<EOF >EXPECTED
\r
492 +{"id": 1, "content-type": "multipart/signed", "content": [
\r
493 +{"id": 2, "content-type": "multipart/mixed", "content": [
\r
494 +{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Subject": "html message", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [
\r
495 +{"id": 4, "content-type": "multipart/alternative", "content": [
\r
496 +{"id": 5, "content-type": "text/html"},
\r
497 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]},
\r
498 +{"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"},
\r
499 +{"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]},
\r
500 +{"id": 9, "content-type": "application/pgp-signature"}]}
\r
502 +test_expect_equal_file OUTPUT EXPECTED
\r
504 test_begin_subtest "--format=json --part=2, multipart/mixed"
\r
505 -output=$(notmuch show --format=json --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
506 -test_expect_equal "$output" \
\r
507 -'{"id": 2, "content-type": "multipart/mixed", "content": [{"id": 3, "content-type": "message/rfc822", "content": [{"id": 4, "content-type": "text/html"}]}, {"id": 5, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, {"id": 6, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}'
\r
509 -test_begin_subtest "--format=json --part=3, rfc822 multipart"
\r
510 -output=$(notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
511 -test_expect_equal "$output" \
\r
512 -'{"id": 3, "content-type": "message/rfc822", "content": [{"id": 4, "content-type": "text/html"}]}'
\r
514 -test_begin_subtest "--format=json --part=4, html part"
\r
515 -output=$(notmuch show --format=json --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
516 -test_expect_equal "$output" \
\r
517 -'{"id": 4, "content-type": "text/html"}'
\r
519 -test_begin_subtest "--format=json --part=5, inline attachment"
\r
520 -output=$(notmuch show --format=json --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
521 -test_expect_equal "$output" \
\r
522 -'{"id": 5, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}'
\r
524 -test_begin_subtest "--format=json --part=6, plain text part"
\r
525 -output=$(notmuch show --format=json --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
526 -test_expect_equal "$output" \
\r
527 -'{"id": 6, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}'
\r
529 -test_begin_subtest "--format=json --part=7, pgp signature (unverified)"
\r
530 -output=$(notmuch show --format=json --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
531 -test_expect_equal "$output" \
\r
532 -'{"id": 7, "content-type": "application/pgp-signature"}'
\r
533 +notmuch show --format=json --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
534 +echo >>OUTPUT # expect *no* newline at end of output
\r
535 +cat <<EOF >EXPECTED
\r
537 +{"id": 2, "content-type": "multipart/mixed", "content": [
\r
538 +{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Subject": "html message", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [
\r
539 +{"id": 4, "content-type": "multipart/alternative", "content": [
\r
540 +{"id": 5, "content-type": "text/html"},
\r
541 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]},
\r
542 +{"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"},
\r
543 +{"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}
\r
545 +test_expect_equal_file OUTPUT EXPECTED
\r
547 +test_begin_subtest "--format=json --part=3, rfc822 part"
\r
548 +notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
549 +echo >>OUTPUT # expect *no* newline at end of output
\r
550 +cat <<EOF >EXPECTED
\r
552 +{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Subject": "html message", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [
\r
553 +{"id": 4, "content-type": "multipart/alternative", "content": [
\r
554 +{"id": 5, "content-type": "text/html"},
\r
555 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}
\r
557 +test_expect_equal_file OUTPUT EXPECTED
\r
559 +test_begin_subtest "--format=json --part=4, rfc822's multipart/alternative"
\r
560 +notmuch show --format=json --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
561 +echo >>OUTPUT # expect *no* newline at end of output
\r
562 +cat <<EOF >EXPECTED
\r
564 +{"id": 4, "content-type": "multipart/alternative", "content": [
\r
565 +{"id": 5, "content-type": "text/html"},
\r
566 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}
\r
568 +test_expect_equal_file OUTPUT EXPECTED
\r
570 +test_begin_subtest "--format=json --part=5, rfc822's html part"
\r
571 +notmuch show --format=json --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
572 +echo >>OUTPUT # expect *no* newline at end of output
\r
573 +cat <<EOF >EXPECTED
\r
575 +{"id": 5, "content-type": "text/html"}
\r
577 +test_expect_equal_file OUTPUT EXPECTED
\r
579 +test_begin_subtest "--format=json --part=6, rfc822's text part"
\r
580 +notmuch show --format=json --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
581 +echo >>OUTPUT # expect *no* newline at end of output
\r
582 +cat <<EOF >EXPECTED
\r
584 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}
\r
586 +test_expect_equal_file OUTPUT EXPECTED
\r
588 +test_begin_subtest "--format=json --part=7, inline attachment"
\r
589 +notmuch show --format=json --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
590 +echo >>OUTPUT # expect *no* newline at end of output
\r
591 +cat <<EOF >EXPECTED
\r
593 +{"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}
\r
595 +test_expect_equal_file OUTPUT EXPECTED
\r
597 +test_begin_subtest "--format=json --part=8, plain text part"
\r
598 +notmuch show --format=json --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
599 +echo >>OUTPUT # expect *no* newline at end of output
\r
600 +cat <<EOF >EXPECTED
\r
602 +{"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}
\r
604 +test_expect_equal_file OUTPUT EXPECTED
\r
606 +test_begin_subtest "--format=json --part=9, pgp signature (unverified)"
\r
607 +notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
608 +echo >>OUTPUT # expect *no* newline at end of output
\r
609 +cat <<EOF >EXPECTED
\r
611 +{"id": 9, "content-type": "application/pgp-signature"}
\r
613 +test_expect_equal_file OUTPUT EXPECTED
\r
615 test_expect_success \
\r
616 - "--format=json --part=8, no part, expect error" \
\r
617 - "notmuch show --format=json --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'"
\r
618 + "--format=json --part=10, no part, expect error" \
\r
619 + "notmuch show --format=json --part=10 'id:87liy5ap00.fsf@yoom.home.cworth.org'"
\r
621 test_begin_subtest "--format=raw"
\r
622 notmuch show --format=raw 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
623 @@ -289,7 +457,13 @@ notmuch show --format=raw --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUT
\r
624 # output should *not* include newline
\r
626 cat <<EOF >EXPECTED
\r
627 -<p>This is an embedded message, with a single html part.</p>
\r
628 +From: Carl Worth <cworth@cworth.org>
\r
629 +To: cworth@cworth.org
\r
630 +Subject: html message
\r
631 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
633 +<p>This is an embedded message, with a multipart/alternative part.</p>
\r
634 +This is an embedded message, with a multipart/alternative part.
\r
635 This is a text attachment.
\r
636 And this message is signed.
\r
638 @@ -307,7 +481,13 @@ test_expect_equal_file OUTPUT EXPECTED
\r
639 test_begin_subtest "--format=raw --part=2, multipart/mixed"
\r
640 notmuch show --format=raw --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
641 cat <<EOF >EXPECTED
\r
642 -<p>This is an embedded message, with a single html part.</p>
\r
643 +From: Carl Worth <cworth@cworth.org>
\r
644 +To: cworth@cworth.org
\r
645 +Subject: html message
\r
646 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
648 +<p>This is an embedded message, with a multipart/alternative part.</p>
\r
649 +This is an embedded message, with a multipart/alternative part.
\r
650 This is a text attachment.
\r
651 And this message is signed.
\r
653 @@ -315,29 +495,41 @@ And this message is signed.
\r
655 test_expect_equal_file OUTPUT EXPECTED
\r
657 -test_begin_subtest "--format=raw --part=3, rfc822 multipart"
\r
658 +test_begin_subtest "--format=raw --part=3, rfc822 part"
\r
659 notmuch show --format=raw --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
660 +test_expect_equal_file OUTPUT embedded_message
\r
662 +test_begin_subtest "--format=raw --part=4, rfc822's html part"
\r
663 +notmuch show --format=raw --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
664 cat <<EOF >EXPECTED
\r
665 -<p>This is an embedded message, with a single html part.</p>
\r
666 +<p>This is an embedded message, with a multipart/alternative part.</p>
\r
667 +This is an embedded message, with a multipart/alternative part.
\r
669 test_expect_equal_file OUTPUT EXPECTED
\r
671 -test_begin_subtest "--format=raw --part=4, html part"
\r
672 -notmuch show --format=raw --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
673 +test_begin_subtest "--format=raw --part=5, rfc822's html part"
\r
674 +notmuch show --format=raw --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
675 cat <<EOF >EXPECTED
\r
676 -<p>This is an embedded message, with a single html part.</p>
\r
677 +<p>This is an embedded message, with a multipart/alternative part.</p>
\r
679 test_expect_equal_file OUTPUT EXPECTED
\r
681 -test_begin_subtest "--format=raw --part=5, inline attachment"
\r
682 -notmuch show --format=raw --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
683 +test_begin_subtest "--format=raw --part=6, rfc822's text part"
\r
684 +notmuch show --format=raw --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
685 +cat <<EOF >EXPECTED
\r
686 +This is an embedded message, with a multipart/alternative part.
\r
688 +test_expect_equal_file OUTPUT EXPECTED
\r
690 +test_begin_subtest "--format=raw --part=7, inline attachment"
\r
691 +notmuch show --format=raw --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
692 cat <<EOF >EXPECTED
\r
693 This is a text attachment.
\r
695 test_expect_equal_file OUTPUT EXPECTED
\r
697 -test_begin_subtest "--format=raw --part=6, plain text part"
\r
698 -notmuch show --format=raw --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
699 +test_begin_subtest "--format=raw --part=8, plain text part"
\r
700 +notmuch show --format=raw --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
701 cat <<EOF >EXPECTED
\r
702 And this message is signed.
\r
704 @@ -345,8 +537,8 @@ And this message is signed.
\r
706 test_expect_equal_file OUTPUT EXPECTED
\r
708 -test_begin_subtest "--format=raw --part=7, pgp signature (unverified)"
\r
709 -notmuch show --format=raw --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
710 +test_begin_subtest "--format=raw --part=9, pgp signature (unverified)"
\r
711 +notmuch show --format=raw --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
712 # output should *not* include newline
\r
714 cat <<EOF >EXPECTED
\r
715 @@ -361,7 +553,7 @@ EOF
\r
716 test_expect_equal_file OUTPUT EXPECTED
\r
718 test_expect_success \
\r
719 - "--format=raw --part=8, no part, expect error" \
\r
720 + "--format=raw --part=10, no part, expect error" \
\r
721 "notmuch show --format=raw --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'"
\r
723 test_begin_subtest "--format=mbox"
\r
724 @@ -388,8 +580,14 @@ References: <87liy5ap00.fsf@yoom.home.cworth.org>
\r
725 On Fri, 05 Jan 2001 15:43:57 +0000, Carl Worth <cworth@cworth.org> wrote:
\r
726 Non-text part: multipart/signed
\r
727 Non-text part: multipart/mixed
\r
728 -Non-text part: message/rfc822
\r
729 +> From: Carl Worth <cworth@cworth.org>
\r
730 +> To: cworth@cworth.org
\r
731 +> Subject: html message
\r
732 +> Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
734 +Non-text part: multipart/alternative
\r
735 Non-text part: text/html
\r
736 +> This is an embedded message, with a multipart/alternative part.
\r
737 > This is a text attachment.
\r
738 > And this message is signed.
\r