1 Return-Path: <jrollins@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 60A7F431FD0
\r
6 for <notmuch@notmuchmail.org>; Mon, 5 Sep 2011 12:01:55 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id xfnjeu8euJDH for <notmuch@notmuchmail.org>;
\r
16 Mon, 5 Sep 2011 12:01:53 -0700 (PDT)
\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu
\r
19 by olra.theworths.org (Postfix) with ESMTP id 3F144431FB6
\r
20 for <notmuch@notmuchmail.org>; Mon, 5 Sep 2011 12:01:53 -0700 (PDT)
\r
21 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])
\r
22 by fire-doxen-postvirus (Postfix) with ESMTP id 8775B328142
\r
23 for <notmuch@notmuchmail.org>; Mon, 5 Sep 2011 12:01:50 -0700 (PDT)
\r
24 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new
\r
25 Received: from finestructure.net (cpe-76-166-145-155.socal.res.rr.com
\r
26 [76.166.145.155]) (Authenticated sender: jrollins)
\r
27 by fire-doxen-submit (Postfix) with ESMTP id 02B93328136
\r
28 for <notmuch@notmuchmail.org>; Mon, 5 Sep 2011 12:01:46 -0700 (PDT)
\r
29 Received: by finestructure.net (Postfix, from userid 1000)
\r
30 id 2E3B2E3D; Mon, 5 Sep 2011 12:01:46 -0700 (PDT)
\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>
\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
33 Subject: [PATCH] test: overhaul multipart test to test for improved
\r
34 message/rfc822 handling
\r
35 Date: Mon, 5 Sep 2011 12:01:46 -0700
\r
36 Message-Id: <1315249306-22328-1-git-send-email-jrollins@finestructure.net>
\r
37 X-Mailer: git-send-email 1.7.5.4
\r
38 In-Reply-To: <1307320169-29905-4-git-send-email-jrollins@finestructure.net>
\r
39 References: <1307320169-29905-4-git-send-email-jrollins@finestructure.net>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Mon, 05 Sep 2011 19:01:55 -0000
\r
54 The main goal of this overhaul is to define how message/rfc822 parts
\r
55 should be handled. message/rfc822 parts should be output in a similar
\r
56 fashion to the outer message, including some subset of the rfc822
\r
57 headers. The following decisions about formatting of message/rfc822
\r
60 The format and content of message/rfc822 parts shall be as similar as
\r
61 possible to that of full messages. In particular, for formatted
\r
62 outputs, the "content" of rfc822 part output should include "headers"
\r
65 The "body" field shall include the body of the message.
\r
67 The "headers" field shall include the following headers, since these
\r
68 are the ones available from the GMimeMessage:
\r
76 However, for the case of --format=raw the raw rfc822 should be output,
\r
77 including all headers.
\r
79 A subset of relevant headers shall be output in reply.
\r
81 The test embedded rfc822 message is also modified to be itself
\r
82 multipart, so we can more fully test how all sub parts of the message
\r
85 This updated patch fixes some conflicts with the current master head.
\r
87 test/multipart | 368 +++++++++++++++++++++++++++++++++++++++++++-------------
\r
88 1 files changed, 283 insertions(+), 85 deletions(-)
\r
90 diff --git a/test/multipart b/test/multipart
\r
91 index ef859d1..0fd1c7e 100755
\r
92 --- a/test/multipart
\r
93 +++ b/test/multipart
\r
95 test_description="output of multipart message"
\r
98 +cat <<EOF > embedded_message
\r
99 +From: Carl Worth <cworth@cworth.org>
\r
100 +To: cworth@cworth.org
\r
101 +Subject: html message
\r
102 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
103 +User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu)
\r
104 +Message-ID: <87liy5ap01.fsf@yoom.home.cworth.org>
\r
106 +Content-Type: multipart/alternative; boundary="==-=-=="
\r
109 +Content-Type: text/html
\r
111 +<p>This is an embedded message, with a multipart/alternative part.</p>
\r
114 +Content-Type: text/plain
\r
116 +This is an embedded message, with a multipart/alternative part.
\r
121 cat <<EOF > ${MAIL_DIR}/multipart
\r
122 From: Carl Worth <cworth@cworth.org>
\r
123 To: cworth@cworth.org
\r
124 @@ -20,17 +43,9 @@ Content-Type: multipart/mixed; boundary="=-=-="
\r
125 Content-Type: message/rfc822
\r
126 Content-Disposition: inline
\r
128 -From: Carl Worth <cworth@cworth.org>
\r
129 -To: cworth@cworth.org
\r
130 -Subject: html message
\r
131 -Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
132 -User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu)
\r
133 -Message-ID: <87liy5ap01.fsf@yoom.home.cworth.org>
\r
135 -Content-Type: text/html
\r
137 -<p>This is an embedded message, with a single html part.</p>
\r
140 +cat embedded_message >> ${MAIL_DIR}/multipart
\r
141 +cat <<EOF >> ${MAIL_DIR}/multipart
\r
143 Content-Disposition: attachment; filename=attachment
\r
145 @@ -105,20 +120,33 @@ Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
147 part{ ID: 1, Content-type: multipart/signed
\r
149 part{ ID: 2, Content-type: multipart/mixed
\r
151 part{ ID: 3, Content-type: message/rfc822
\r
153 part{ ID: 4, Content-type: text/html
\r
156 +From: Carl Worth <cworth@cworth.org>
\r
157 +To: cworth@cworth.org
\r
158 +Subject: html message
\r
159 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
165 part{ ID: 4, Content-type: multipart/alternative
\r
167 part{ ID: 5, Content-type: text/html
\r
168 Non-text part: text/html
\r
172 part{ ID: 6, Content-type: text/plain
\r
173 +This is an embedded message, with a multipart/alternative part.
\r
183 attachment{ ID: 5, Filename: attachment, Content-type: text/plain
\r
185 attachment{ ID: 7, Filename: attachment, Content-type: text/plain
\r
186 This is a text attachment.
\r
190 part{ ID: 6, Content-type: text/plain
\r
192 part{ ID: 8, Content-type: text/plain
\r
193 And this message is signed.
\r
201 part{ ID: 7, Content-type: application/pgp-signature
\r
203 part{ ID: 9, Content-type: application/pgp-signature
\r
204 Non-text part: application/pgp-signature
\r
209 @@ -133,20 +161,33 @@ cat <<EOF >EXPECTED
\r
211 part{ ID: 1, Content-type: multipart/signed
\r
213 part{ ID: 2, Content-type: multipart/mixed
\r
215 part{ ID: 3, Content-type: message/rfc822
\r
217 part{ ID: 4, Content-type: text/html
\r
220 +From: Carl Worth <cworth@cworth.org>
\r
221 +To: cworth@cworth.org
\r
222 +Subject: html message
\r
223 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
229 part{ ID: 4, Content-type: multipart/alternative
\r
231 part{ ID: 5, Content-type: text/html
\r
232 Non-text part: text/html
\r
236 part{ ID: 6, Content-type: text/plain
\r
237 +This is an embedded message, with a multipart/alternative part.
\r
243 attachment{ ID: 5, Filename: attachment, Content-type: text/plain
\r
249 attachment{ ID: 7, Filename: attachment, Content-type: text/plain
\r
250 This is a text attachment.
\r
254 part{ ID: 6, Content-type: text/plain
\r
256 part{ ID: 8, Content-type: text/plain
\r
257 And this message is signed.
\r
265 part{ ID: 7, Content-type: application/pgp-signature
\r
267 part{ ID: 9, Content-type: application/pgp-signature
\r
268 Non-text part: application/pgp-signature
\r
273 @@ -158,14 +199,27 @@ notmuch show --format=text --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OU
\r
274 cat <<EOF >EXPECTED
\r
276 part{ ID: 2, Content-type: multipart/mixed
\r
278 part{ ID: 3, Content-type: message/rfc822
\r
280 part{ ID: 4, Content-type: text/html
\r
283 +From: Carl Worth <cworth@cworth.org>
\r
284 +To: cworth@cworth.org
\r
285 +Subject: html message
\r
286 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
292 part{ ID: 4, Content-type: multipart/alternative
\r
294 part{ ID: 5, Content-type: text/html
\r
295 Non-text part: text/html
\r
299 part{ ID: 6, Content-type: text/plain
\r
300 +This is an embedded message, with a multipart/alternative part.
\r
306 attachment{ ID: 5, Filename: attachment, Content-type: text/plain
\r
312 attachment{ ID: 7, Filename: attachment, Content-type: text/plain
\r
313 This is a text attachment.
\r
317 part{ ID: 6, Content-type: text/plain
\r
319 part{ ID: 8, Content-type: text/plain
\r
320 And this message is signed.
\r
323 @@ -174,39 +228,75 @@ And this message is signed.
\r
325 test_expect_equal_file OUTPUT EXPECTED
\r
327 -test_begin_subtest "--format=text --part=3, rfc822 multipart"
\r
328 +test_begin_subtest "--format=text --part=3, rfc822 part"
\r
329 notmuch show --format=text --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
330 cat <<EOF >EXPECTED
\r
332 part{ ID: 3, Content-type: message/rfc822
\r
334 part{ ID: 4, Content-type: text/html
\r
337 +From: Carl Worth <cworth@cworth.org>
\r
338 +To: cworth@cworth.org
\r
339 +Subject: html message
\r
340 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
346 part{ ID: 4, Content-type: multipart/alternative
\r
348 part{ ID: 5, Content-type: text/html
\r
349 Non-text part: text/html
\r
353 part{ ID: 6, Content-type: text/plain
\r
354 +This is an embedded message, with a multipart/alternative part.
\r
364 test_expect_equal_file OUTPUT EXPECTED
\r
366 -test_begin_subtest "--format=text --part=4, html part"
\r
367 +test_begin_subtest "--format=text --part=4, rfc822's multipart"
\r
368 notmuch show --format=text --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
369 cat <<EOF >EXPECTED
\r
371 part{ ID: 4, Content-type: text/html
\r
373 part{ ID: 4, Content-type: multipart/alternative
\r
375 part{ ID: 5, Content-type: text/html
\r
376 Non-text part: text/html
\r
380 part{ ID: 6, Content-type: text/plain
\r
381 +This is an embedded message, with a multipart/alternative part.
\r
387 test_expect_equal_file OUTPUT EXPECTED
\r
389 -test_begin_subtest "--format=text --part=5, inline attachment"
\r
390 +test_begin_subtest "--format=text --part=5, rfc822's html part"
\r
391 notmuch show --format=text --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
392 cat <<EOF >EXPECTED
\r
394 attachment{ ID: 5, Filename: attachment, Content-type: text/plain
\r
395 -This is a text attachment.
\r
399 part{ ID: 5, Content-type: text/html
\r
400 +Non-text part: text/html
\r
404 test_expect_equal_file OUTPUT EXPECTED
\r
406 -test_begin_subtest "--format=text --part=6, plain text part"
\r
407 +test_begin_subtest "--format=text --part=6, rfc822's text part"
\r
408 notmuch show --format=text --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
409 cat <<EOF >EXPECTED
\r
411 part{ ID: 6, Content-type: text/plain
\r
412 +This is an embedded message, with a multipart/alternative part.
\r
416 +test_expect_equal_file OUTPUT EXPECTED
\r
418 +test_begin_subtest "--format=text --part=7, inline attachement"
\r
419 +notmuch show --format=text --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
420 +cat <<EOF >EXPECTED
\r
422 attachment{ ID: 7, Filename: attachment, Content-type: text/plain
\r
423 +This is a text attachment.
\r
427 +test_expect_equal_file OUTPUT EXPECTED
\r
429 +test_begin_subtest "--format=text --part=8, plain text part"
\r
430 +notmuch show --format=text --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
431 +cat <<EOF >EXPECTED
\r
433 part{ ID: 8, Content-type: text/plain
\r
434 And this message is signed.
\r
437 @@ -214,10 +304,10 @@ And this message is signed.
\r
439 test_expect_equal_file OUTPUT EXPECTED
\r
441 -test_begin_subtest "--format=text --part=7, pgp signature (unverified)"
\r
442 -notmuch show --format=text --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
443 +test_begin_subtest "--format=text --part=9, pgp signature (unverified)"
\r
444 +notmuch show --format=text --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
445 cat <<EOF >EXPECTED
\r
447 part{ ID: 7, Content-type: application/pgp-signature
\r
449 part{ ID: 9, Content-type: application/pgp-signature
\r
450 Non-text part: application/pgp-signature
\r
454 @@ -228,48 +318,126 @@ test_expect_success \
\r
455 "notmuch show --format=text --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'"
\r
457 test_begin_subtest "--format=json --part=0, full message"
\r
458 -output=$(notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
459 -test_expect_equal "$output" \
\r
460 -'{"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
461 +notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
462 +echo >>OUTPUT # expect *no* newline at end of output
\r
463 +cat <<EOF >EXPECTED
\r
465 +{"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
466 +{"id": 1, "content-type": "multipart/signed", "content": [
\r
467 +{"id": 2, "content-type": "multipart/mixed", "content": [
\r
468 +{"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
469 +{"id": 4, "content-type": "multipart/alternative", "content": [
\r
470 +{"id": 5, "content-type": "text/html"},
\r
471 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]},
\r
472 +{"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"},
\r
473 +{"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]},
\r
474 +{"id": 9, "content-type": "application/pgp-signature"}]}]}
\r
476 +test_expect_equal_file OUTPUT EXPECTED
\r
478 test_begin_subtest "--format=json --part=1, message body"
\r
479 -output=$(notmuch show --format=json --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
480 -test_expect_equal "$output" \
\r
481 -'{"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
482 +notmuch show --format=json --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
483 +echo >>OUTPUT # expect *no* newline at end of output
\r
484 +cat <<EOF >EXPECTED
\r
486 +{"id": 1, "content-type": "multipart/signed", "content": [
\r
487 +{"id": 2, "content-type": "multipart/mixed", "content": [
\r
488 +{"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
489 +{"id": 4, "content-type": "multipart/alternative", "content": [
\r
490 +{"id": 5, "content-type": "text/html"},
\r
491 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]},
\r
492 +{"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"},
\r
493 +{"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]},
\r
494 +{"id": 9, "content-type": "application/pgp-signature"}]}
\r
496 +test_expect_equal_file OUTPUT EXPECTED
\r
498 test_begin_subtest "--format=json --part=2, multipart/mixed"
\r
499 -output=$(notmuch show --format=json --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
500 -test_expect_equal "$output" \
\r
501 -'{"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
503 -test_begin_subtest "--format=json --part=3, rfc822 multipart"
\r
504 -output=$(notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
505 -test_expect_equal "$output" \
\r
506 -'{"id": 3, "content-type": "message/rfc822", "content": [{"id": 4, "content-type": "text/html"}]}'
\r
508 -test_begin_subtest "--format=json --part=4, html part"
\r
509 -output=$(notmuch show --format=json --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
510 -test_expect_equal "$output" \
\r
511 -'{"id": 4, "content-type": "text/html"}'
\r
513 -test_begin_subtest "--format=json --part=5, inline attachment"
\r
514 -output=$(notmuch show --format=json --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
515 -test_expect_equal "$output" \
\r
516 -'{"id": 5, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}'
\r
518 -test_begin_subtest "--format=json --part=6, plain text part"
\r
519 -output=$(notmuch show --format=json --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
520 -test_expect_equal "$output" \
\r
521 -'{"id": 6, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}'
\r
523 -test_begin_subtest "--format=json --part=7, pgp signature (unverified)"
\r
524 -output=$(notmuch show --format=json --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
525 -test_expect_equal "$output" \
\r
526 -'{"id": 7, "content-type": "application/pgp-signature"}'
\r
527 +notmuch show --format=json --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
528 +echo >>OUTPUT # expect *no* newline at end of output
\r
529 +cat <<EOF >EXPECTED
\r
531 +{"id": 2, "content-type": "multipart/mixed", "content": [
\r
532 +{"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
533 +{"id": 4, "content-type": "multipart/alternative", "content": [
\r
534 +{"id": 5, "content-type": "text/html"},
\r
535 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]},
\r
536 +{"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"},
\r
537 +{"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}
\r
539 +test_expect_equal_file OUTPUT EXPECTED
\r
541 +test_begin_subtest "--format=json --part=3, rfc822 part"
\r
542 +notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
543 +echo >>OUTPUT # expect *no* newline at end of output
\r
544 +cat <<EOF >EXPECTED
\r
546 +{"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
547 +{"id": 4, "content-type": "multipart/alternative", "content": [
\r
548 +{"id": 5, "content-type": "text/html"},
\r
549 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}
\r
551 +test_expect_equal_file OUTPUT EXPECTED
\r
553 +test_begin_subtest "--format=json --part=4, rfc822's multipart/alternative"
\r
554 +notmuch show --format=json --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
555 +echo >>OUTPUT # expect *no* newline at end of output
\r
556 +cat <<EOF >EXPECTED
\r
558 +{"id": 4, "content-type": "multipart/alternative", "content": [
\r
559 +{"id": 5, "content-type": "text/html"},
\r
560 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}
\r
562 +test_expect_equal_file OUTPUT EXPECTED
\r
564 +test_begin_subtest "--format=json --part=5, rfc822's html part"
\r
565 +notmuch show --format=json --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
566 +echo >>OUTPUT # expect *no* newline at end of output
\r
567 +cat <<EOF >EXPECTED
\r
569 +{"id": 5, "content-type": "text/html"}
\r
571 +test_expect_equal_file OUTPUT EXPECTED
\r
573 +test_begin_subtest "--format=json --part=6, rfc822's text part"
\r
574 +notmuch show --format=json --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
575 +echo >>OUTPUT # expect *no* newline at end of output
\r
576 +cat <<EOF >EXPECTED
\r
578 +{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}
\r
580 +test_expect_equal_file OUTPUT EXPECTED
\r
582 +test_begin_subtest "--format=json --part=7, inline attachment"
\r
583 +notmuch show --format=json --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
584 +echo >>OUTPUT # expect *no* newline at end of output
\r
585 +cat <<EOF >EXPECTED
\r
587 +{"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}
\r
589 +test_expect_equal_file OUTPUT EXPECTED
\r
591 +test_begin_subtest "--format=json --part=8, plain text part"
\r
592 +notmuch show --format=json --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
593 +echo >>OUTPUT # expect *no* newline at end of output
\r
594 +cat <<EOF >EXPECTED
\r
596 +{"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}
\r
598 +test_expect_equal_file OUTPUT EXPECTED
\r
600 +test_begin_subtest "--format=json --part=9, pgp signature (unverified)"
\r
601 +notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT
\r
602 +echo >>OUTPUT # expect *no* newline at end of output
\r
603 +cat <<EOF >EXPECTED
\r
605 +{"id": 9, "content-type": "application/pgp-signature"}
\r
607 +test_expect_equal_file OUTPUT EXPECTED
\r
609 test_expect_success \
\r
610 - "--format=json --part=8, no part, expect error" \
\r
611 - "notmuch show --format=json --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'"
\r
612 + "--format=json --part=10, no part, expect error" \
\r
613 + "notmuch show --format=json --part=10 'id:87liy5ap00.fsf@yoom.home.cworth.org'"
\r
615 test_begin_subtest "--format=raw"
\r
616 notmuch show --format=raw 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
617 @@ -284,7 +452,13 @@ notmuch show --format=raw --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUT
\r
618 # output should *not* include newline
\r
620 cat <<EOF >EXPECTED
\r
621 -<p>This is an embedded message, with a single html part.</p>
\r
622 +From: Carl Worth <cworth@cworth.org>
\r
623 +To: cworth@cworth.org
\r
624 +Subject: html message
\r
625 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
627 +<p>This is an embedded message, with a multipart/alternative part.</p>
\r
628 +This is an embedded message, with a multipart/alternative part.
\r
629 This is a text attachment.
\r
630 And this message is signed.
\r
632 @@ -302,7 +476,13 @@ test_expect_equal_file OUTPUT EXPECTED
\r
633 test_begin_subtest "--format=raw --part=2, multipart/mixed"
\r
634 notmuch show --format=raw --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
635 cat <<EOF >EXPECTED
\r
636 -<p>This is an embedded message, with a single html part.</p>
\r
637 +From: Carl Worth <cworth@cworth.org>
\r
638 +To: cworth@cworth.org
\r
639 +Subject: html message
\r
640 +Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
642 +<p>This is an embedded message, with a multipart/alternative part.</p>
\r
643 +This is an embedded message, with a multipart/alternative part.
\r
644 This is a text attachment.
\r
645 And this message is signed.
\r
647 @@ -310,29 +490,41 @@ And this message is signed.
\r
649 test_expect_equal_file OUTPUT EXPECTED
\r
651 -test_begin_subtest "--format=raw --part=3, rfc822 multipart"
\r
652 +test_begin_subtest "--format=raw --part=3, rfc822 part"
\r
653 notmuch show --format=raw --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
654 +test_expect_equal_file OUTPUT embedded_message
\r
656 +test_begin_subtest "--format=raw --part=4, rfc822's html part"
\r
657 +notmuch show --format=raw --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
658 cat <<EOF >EXPECTED
\r
659 -<p>This is an embedded message, with a single html part.</p>
\r
660 +<p>This is an embedded message, with a multipart/alternative part.</p>
\r
661 +This is an embedded message, with a multipart/alternative part.
\r
663 test_expect_equal_file OUTPUT EXPECTED
\r
665 -test_begin_subtest "--format=raw --part=4, html part"
\r
666 -notmuch show --format=raw --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
667 +test_begin_subtest "--format=raw --part=5, rfc822's html part"
\r
668 +notmuch show --format=raw --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
669 cat <<EOF >EXPECTED
\r
670 -<p>This is an embedded message, with a single html part.</p>
\r
671 +<p>This is an embedded message, with a multipart/alternative part.</p>
\r
673 test_expect_equal_file OUTPUT EXPECTED
\r
675 -test_begin_subtest "--format=raw --part=5, inline attachment"
\r
676 -notmuch show --format=raw --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
677 +test_begin_subtest "--format=raw --part=6, rfc822's text part"
\r
678 +notmuch show --format=raw --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
679 +cat <<EOF >EXPECTED
\r
680 +This is an embedded message, with a multipart/alternative part.
\r
682 +test_expect_equal_file OUTPUT EXPECTED
\r
684 +test_begin_subtest "--format=raw --part=7, inline attachment"
\r
685 +notmuch show --format=raw --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
686 cat <<EOF >EXPECTED
\r
687 This is a text attachment.
\r
689 test_expect_equal_file OUTPUT EXPECTED
\r
691 -test_begin_subtest "--format=raw --part=6, plain text part"
\r
692 -notmuch show --format=raw --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
693 +test_begin_subtest "--format=raw --part=8, plain text part"
\r
694 +notmuch show --format=raw --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
695 cat <<EOF >EXPECTED
\r
696 And this message is signed.
\r
698 @@ -340,8 +532,8 @@ And this message is signed.
\r
700 test_expect_equal_file OUTPUT EXPECTED
\r
702 -test_begin_subtest "--format=raw --part=7, pgp signature (unverified)"
\r
703 -notmuch show --format=raw --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
704 +test_begin_subtest "--format=raw --part=9, pgp signature (unverified)"
\r
705 +notmuch show --format=raw --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
706 # output should *not* include newline
\r
708 cat <<EOF >EXPECTED
\r
709 @@ -356,7 +548,7 @@ EOF
\r
710 test_expect_equal_file OUTPUT EXPECTED
\r
712 test_expect_success \
\r
713 - "--format=raw --part=8, no part, expect error" \
\r
714 + "--format=raw --part=10, no part, expect error" \
\r
715 "notmuch show --format=raw --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'"
\r
717 test_begin_subtest "--format=mbox"
\r
718 @@ -383,8 +575,14 @@ References: <87liy5ap00.fsf@yoom.home.cworth.org>
\r
719 On Fri, 05 Jan 2001 15:43:57 +0000, Carl Worth <cworth@cworth.org> wrote:
\r
720 Non-text part: multipart/signed
\r
721 Non-text part: multipart/mixed
\r
722 -Non-text part: message/rfc822
\r
723 +> From: Carl Worth <cworth@cworth.org>
\r
724 +> To: cworth@cworth.org
\r
725 +> Subject: html message
\r
726 +> Date: Fri, 05 Jan 2001 15:42:57 +0000
\r
728 +Non-text part: multipart/alternative
\r
729 Non-text part: text/html
\r
730 +> This is an embedded message, with a multipart/alternative part.
\r
731 > This is a text attachment.
\r
732 > And this message is signed.
\r