X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2FT190-multipart.sh;h=9ad141cb5ace12793a477a152dbf271958d2672d;hp=12a10451b408bd362ecd5472e2c7c0bb28222b42;hb=HEAD;hpb=0aba694c11846f76cfa64470d10a50cec8e43bd5 diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh index 12a10451..cfe48ac5 100755 --- a/test/T190-multipart.sh +++ b/test/T190-multipart.sh @@ -1,15 +1,8 @@ #!/usr/bin/env bash test_description="output of multipart message" -. ./test-lib.sh || exit 1 +. $(dirname "$0")/test-lib.sh || exit 1 -cat < embedded_message -From: Carl Worth -To: cworth@cworth.org -Subject: html message -Date: Fri, 05 Jan 2001 15:42:57 +0000 -User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu) -Message-ID: <87liy5ap01.fsf@yoom.home.cworth.org> -MIME-Version: 1.0 +cat < embedded_message_body Content-Type: multipart/alternative; boundary="==-=-==" --==-=-== @@ -24,15 +17,19 @@ This is an embedded message, with a multipart/alternative part. --==-=-==-- EOF - -cat < ${MAIL_DIR}/multipart +cat < embedded_message From: Carl Worth To: cworth@cworth.org -Subject: Multipart message -Date: Fri, 05 Jan 2001 15:43:57 +0000 +Subject: html message +Date: Fri, 05 Jan 2001 15:42: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> +Message-ID: <87liy5ap01.fsf@yoom.home.cworth.org> MIME-Version: 1.0 +EOF + +cat embedded_message_body >> embedded_message + +cat < multipart_body Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" @@ -44,8 +41,9 @@ Content-Type: message/rfc822 Content-Disposition: inline EOF -cat embedded_message >> ${MAIL_DIR}/multipart -cat <> ${MAIL_DIR}/multipart + +cat embedded_message >> multipart_body +cat <> multipart_body --=-=-= Content-Disposition: attachment; filename=attachment @@ -73,6 +71,18 @@ W6cAmQE4dcYrx/LPLtYLZm1jsGauE5hE --==-=-=-- EOF +cat < ${MAIL_DIR}/multipart +From: Carl Worth +To: cworth@cworth.org +Subject: Multipart message +Date: Fri, 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 +EOF + +cat multipart_body >> ${MAIL_DIR}/multipart + cat < ${MAIL_DIR}/base64-part-with-crlf From: Carl Worth To: cworth@cworth.org @@ -180,6 +190,21 @@ Non-text part: application/pgp-signature EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "--format=text --part=0 --body=false, message header" +notmuch show --format=text --part=0 --body=false 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT +cat <EXPECTED + message{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 excluded:0 filename:${MAIL_DIR}/multipart + header{ +Carl Worth (2001-01-05) (attachment inbox signed unread) +Subject: Multipart message +From: Carl Worth +To: cworth@cworth.org +Date: Fri, 05 Jan 2001 15:43:57 +0000 + header} + message} +EOF +test_expect_equal_file EXPECTED OUTPUT + test_begin_subtest "--format=text --part=1, message body" notmuch show --format=text --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT cat <EXPECTED @@ -300,6 +325,15 @@ Non-text part: text/html EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "--format=text --include-html --part=5, rfc822's html part" +notmuch show --format=text --include-html --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT +cat <EXPECTED + part{ ID: 5, Content-type: text/html +

This is an embedded message, with a multipart/alternative part.

+ part} +EOF +test_expect_equal_file EXPECTED OUTPUT + test_begin_subtest "--format=text --part=6, rfc822's text part" notmuch show --format=text --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT cat <EXPECTED @@ -309,7 +343,7 @@ This is an embedded message, with a multipart/alternative part. EOF test_expect_equal_file EXPECTED OUTPUT -test_begin_subtest "--format=text --part=7, inline attachement" +test_begin_subtest "--format=text --part=7, inline attachment" notmuch show --format=text --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT cat <EXPECTED attachment{ ID: 7, Filename: attachment, Content-type: text/plain @@ -342,18 +376,18 @@ test_begin_subtest "--format=text --part=8, no part, expect error" test_expect_success "notmuch show --format=text --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'" test_begin_subtest "--format=json --part=0, full message" -notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT +notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | notmuch_json_show_sanitize >OUTPUT cat <EXPECTED -{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "excluded": false, "filename": ["${MAIL_DIR}/multipart"], "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [ +{"id": "XXXXX", "crypto": {}, "match": true, "excluded": false, "filename": ["YYYYY"], "timestamp": 42, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "GENERATED_DATE"}, "body": [ {"id": 1, "content-type": "multipart/signed", "content": [ {"id": 2, "content-type": "multipart/mixed", "content": [ -{"id": 3, "content-type": "message/rfc822", "content-disposition": "inline", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ +{"id": 3, "content-type": "message/rfc822", "content-disposition": "inline", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "GENERATED_DATE"}, "body": [ {"id": 4, "content-type": "multipart/alternative", "content": [ -{"id": 5, "content-type": "text/html", "content-length": 71}, +{"id": 5, "content-type": "text/html", "content-length": "NONZERO"}, {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, {"id": 7, "content-type": "text/plain", "content-disposition": "attachment", "filename": "attachment", "content": "This is a text attachment.\n"}, {"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, -{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}]}]} +{"id": 9, "content-type": "application/pgp-signature", "content-length": "NONZERO"}]}]} EOF test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" @@ -451,12 +485,12 @@ notmuch show --format=raw 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT test_expect_equal_file "${MAIL_DIR}"/multipart OUTPUT test_begin_subtest "--format=raw --part=0, full message" -notmuch show --format=raw --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT +notmuch show --format=raw --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | notmuch_json_show_sanitize >OUTPUT test_expect_equal_file "${MAIL_DIR}"/multipart OUTPUT test_begin_subtest "--format=raw --part=1, message body" notmuch show --format=raw --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT -test_expect_equal_file "${MAIL_DIR}"/multipart OUTPUT +test_expect_equal_file multipart_body OUTPUT test_begin_subtest "--format=raw --part=2, multipart/mixed" notmuch show --format=raw --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT @@ -509,29 +543,7 @@ test_expect_equal_file embedded_message OUTPUT test_begin_subtest "--format=raw --part=4, rfc822's multipart" notmuch show --format=raw --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT -cat <EXPECTED -From: Carl Worth -To: cworth@cworth.org -Subject: html message -Date: Fri, 05 Jan 2001 15:42:57 +0000 -User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu) -Message-ID: <87liy5ap01.fsf@yoom.home.cworth.org> -MIME-Version: 1.0 -Content-Type: multipart/alternative; boundary="==-=-==" - ---==-=-== -Content-Type: text/html - -

This is an embedded message, with a multipart/alternative part.

- ---==-=-== -Content-Type: text/plain - -This is an embedded message, with a multipart/alternative part. - ---==-=-==-- -EOF -test_expect_equal_file EXPECTED OUTPUT +test_expect_equal_file embedded_message_body OUTPUT test_begin_subtest "--format=raw --part=5, rfc822's html part" notmuch show --format=raw --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT @@ -625,6 +637,7 @@ notmuch_json_show_sanitize <EXPECTED "In-reply-to": "<87liy5ap00.fsf@yoom.home.cworth.org>", "References": "<87liy5ap00.fsf@yoom.home.cworth.org>"}, "original": {"id": "XXXXX", + "crypto": {}, "match": false, "excluded": false, "filename": ["YYYYY"], @@ -670,7 +683,7 @@ test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" test_begin_subtest "'notmuch show --part' does not corrupt a part with CRLF pair" notmuch show --format=raw --part=3 id:base64-part-with-crlf > crlf.out -echo -n -e "\xEF\x0D\x0A" > crlf.expected +printf "\xEF\x0D\x0A" > crlf.expected test_expect_equal_file crlf.out crlf.expected @@ -712,12 +725,12 @@ EOF notmuch new > /dev/null -cat_expected_head () -{ +cat_expected_head () { cat <", "Subject": "html message", "To": "B "}, @@ -729,8 +742,8 @@ EOF cat_expected_head > EXPECTED.nohtml cat <> EXPECTED.nohtml "content": [ - { "id": 2, "content-charset": "UTF-8", "content-length": 21, "content-type": "text/html"}, - { "id": 3, "content-charset": "ISO-8859-1", "content-length": 20, "content-type": "text/html"}, + { "id": 2, "content-charset": "UTF-8", "content-length": "NONZERO", "content-type": "text/html"}, + { "id": 3, "content-charset": "ISO-8859-1", "content-length": "NONZERO", "content-type": "text/html"}, { "id": 4, "content-type": "text/plain", "content": "0.5 equals \\u00bd\\n"} ]}]},[]]]] EOF @@ -746,11 +759,11 @@ cat <> EXPECTED.withhtml EOF test_begin_subtest "html parts excluded by default" -notmuch show --format=json id:htmlmessage > OUTPUT +notmuch show --format=json id:htmlmessage | notmuch_json_show_sanitize > OUTPUT test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.nohtml)" test_begin_subtest "html parts included" -notmuch show --format=json --include-html id:htmlmessage > OUTPUT +notmuch show --format=json --include-html id:htmlmessage | notmuch_json_show_sanitize > OUTPUT test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)" test_begin_subtest "indexes mime-type #1"