From: Peter Wang <novalazy@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/4] test: conform to content-length fields (json)
Date: Sun, 5 Aug 2012 17:22:23 +1000 [thread overview]
Message-ID: <1344151345-25411-2-git-send-email-novalazy@gmail.com> (raw)
In-Reply-To: <1344151345-25411-1-git-send-email-novalazy@gmail.com>
Update tests to expect content-length fields in show --format=json
output, for leaf parts with omitted body content.
---
test/crypto | 25 +++++++++++++++++--------
test/json | 2 +-
test/multipart | 9 +++++----
3 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/test/crypto b/test/crypto
index 5dd14c4..4a73dcc 100755
--- a/test/crypto
+++ b/test/crypto
@@ -61,7 +61,8 @@ expected='[[[{"id": "XXXXX",
"content-type": "text/plain",
"content": "This is a test signed message.\n"},
{"id": 3,
- "content-type": "application/pgp-signature"}]}]},
+ "content-type": "application/pgp-signature",
+ "content-length": 315}]}]},
[]]]]'
test_expect_equal_json \
"$output" \
@@ -95,7 +96,8 @@ expected='[[[{"id": "XXXXX",
"content-type": "text/plain",
"content": "This is a test signed message.\n"},
{"id": 3,
- "content-type": "application/pgp-signature"}]}]},
+ "content-type": "application/pgp-signature",
+ "content-length": 315}]}]},
[]]]]'
test_expect_equal_json \
"$output" \
@@ -127,7 +129,8 @@ expected='[[[{"id": "XXXXX",
"content-type": "text/plain",
"content": "This is a test signed message.\n"},
{"id": 3,
- "content-type": "application/pgp-signature"}]}]},
+ "content-type": "application/pgp-signature",
+ "content-length": 315}]}]},
[]]]]'
test_expect_equal_json \
"$output" \
@@ -196,7 +199,8 @@ expected='[[[{"id": "XXXXX",
"sigstatus": [],
"content-type": "multipart/encrypted",
"content": [{"id": 2,
- "content-type": "application/pgp-encrypted"},
+ "content-type": "application/pgp-encrypted",
+ "content-length": 11},
{"id": 3,
"content-type": "multipart/mixed",
"content": [{"id": 4,
@@ -204,6 +208,7 @@ expected='[[[{"id": "XXXXX",
"content": "This is a test encrypted message.\n"},
{"id": 5,
"content-type": "application/octet-stream",
+ "content-length": 28,
"filename": "TESTATTACHMENT"}]}]}]},
[]]]]'
test_expect_equal_json \
@@ -249,9 +254,11 @@ expected='[[[{"id": "XXXXX",
"encstatus": [{"status": "bad"}],
"content-type": "multipart/encrypted",
"content": [{"id": 2,
- "content-type": "application/pgp-encrypted"},
+ "content-type": "application/pgp-encrypted",
+ "content-length": 11},
{"id": 3,
- "content-type": "application/octet-stream"}]}]},
+ "content-type": "application/octet-stream",
+ "content-length": 652}]}]},
[]]]]'
test_expect_equal_json \
"$output" \
@@ -287,7 +294,8 @@ expected='[[[{"id": "XXXXX",
"userid": " Notmuch Test Suite <test_suite@notmuchmail.org> (INSECURE!)"}],
"content-type": "multipart/encrypted",
"content": [{"id": 2,
- "content-type": "application/pgp-encrypted"},
+ "content-type": "application/pgp-encrypted",
+ "content-length": 11},
{"id": 3,
"content-type": "text/plain",
"content": "This is another test encrypted message.\n"}]}]},
@@ -342,7 +350,8 @@ expected='[[[{"id": "XXXXX",
"content-type": "text/plain",
"content": "This is a test signed message.\n"},
{"id": 3,
- "content-type": "application/pgp-signature"}]}]},
+ "content-type": "application/pgp-signature",
+ "content-length": 315}]}]},
[]]]]'
test_expect_equal_json \
"$output" \
diff --git a/test/json b/test/json
index ac8fa8e..ff2287e 100755
--- a/test/json
+++ b/test/json
@@ -45,7 +45,7 @@ emacs_deliver_message \
(insert \"Message-ID: <$id>\n\")"
output=$(notmuch show --format=json "id:$id")
filename=$(notmuch search --output=files "id:$id")
-test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": \"$filename\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"filename\": \"README\"}]}]}, []]]]"
+test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": \"$filename\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"content-length\": 12392, \"filename\": \"README\"}]}]}, []]]]"
test_begin_subtest "Search message: json, utf-8"
add_message "[subject]=\"json-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\""
diff --git a/test/multipart b/test/multipart
index 0527f84..0f9e113 100755
--- a/test/multipart
+++ b/test/multipart
@@ -330,7 +330,7 @@ cat <<EOF >EXPECTED
{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]},
{"id": 7, "content-type": "text/plain", "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"}]}]}
+{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}]}]}
EOF
test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"
@@ -345,7 +345,7 @@ cat <<EOF >EXPECTED
{"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]},
{"id": 7, "content-type": "text/plain", "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"}]}
+{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}]}
EOF
test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"
@@ -412,7 +412,7 @@ test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"
test_begin_subtest "--format=json --part=9, pgp signature (unverified)"
notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
cat <<EOF >EXPECTED
-{"id": 9, "content-type": "application/pgp-signature"}
+{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}
EOF
test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"
@@ -636,7 +636,8 @@ cat <<EOF >EXPECTED
"content-type": "text/plain",
"content": "And this message is signed.\n\n-Carl\n"}]},
{"id": 9,
- "content-type": "application/pgp-signature"}]}]}}
+ "content-type": "application/pgp-signature",
+ "content-length": 197}]}]}}
EOF
test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"
--
1.7.4.4
next prev parent reply other threads:[~2012-08-05 7:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-05 7:22 [PATCH 1/4] show: indicate length of omitted body content (json) Peter Wang
2012-08-05 7:22 ` Peter Wang [this message]
2012-08-05 7:22 ` [PATCH 3/4] show: indicate length of omitted body content (text) Peter Wang
2012-08-06 16:50 ` Austin Clements
2012-08-05 7:22 ` [PATCH 4/4] test: conform to content-length fields (text) Peter Wang
2012-08-05 9:32 ` [PATCH 1/4] show: indicate length of omitted body content (json) Tomi Ollila
2012-08-05 21:37 ` Jameson Graef Rollins
2012-08-06 14:36 ` Peter Wang
2012-08-06 16:47 ` Austin Clements
2012-08-07 13:24 ` Peter Wang
2012-08-07 13:57 ` Austin Clements
2012-08-07 23:01 ` Mark Walters
2012-08-08 12:31 ` Peter Wang
2012-10-20 1:56 ` Ethan Glasser-Camp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1344151345-25411-2-git-send-email-novalazy@gmail.com \
--to=novalazy@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).