[PATCH 2/4] test: conform to content-length fields (json)
authorPeter Wang <novalazy@gmail.com>
Sun, 5 Aug 2012 07:22:23 +0000 (17:22 +1000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:51 +0000 (09:48 -0800)
4c/34a407071fe978c4ec04f4a720d40cfb5e6f02 [new file with mode: 0644]

diff --git a/4c/34a407071fe978c4ec04f4a720d40cfb5e6f02 b/4c/34a407071fe978c4ec04f4a720d40cfb5e6f02
new file mode 100644 (file)
index 0000000..977e8a0
--- /dev/null
@@ -0,0 +1,217 @@
+Return-Path: <novalazy@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 60C6C431FBF\r
+       for <notmuch@notmuchmail.org>; Sun,  5 Aug 2012 00:22:58 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id WuDIodp+6Y9Z for <notmuch@notmuchmail.org>;\r
+       Sun,  5 Aug 2012 00:22:56 -0700 (PDT)\r
+Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com\r
+       [209.85.160.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 13DE0431FB6\r
+       for <notmuch@notmuchmail.org>; Sun,  5 Aug 2012 00:22:47 -0700 (PDT)\r
+Received: by mail-pb0-f53.google.com with SMTP id ro8so3935886pbb.26\r
+       for <notmuch@notmuchmail.org>; Sun, 05 Aug 2012 00:22:46 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+       :mime-version:content-type:content-transfer-encoding;\r
+       bh=uG4z+lTiI9253NJDkCc+U5QlIeLdCCa3yN6hNnzRJME=;\r
+       b=QOc/Aj7W5qL41WLGtO+T/W9A28HapXTsafEF7VyiBSjNoW0tHU9YSP9GkH/Rs2hg8m\r
+       PrK1fP2rOszbCM7VHRrQGaNRIEM0xjv7yr5Pj8oWZ/w8nY6fYWmIv6SbweTEu1uXFR4B\r
+       Yo69GWLoLC7Ur4g/Jmq+Yf9dIuDfnjUl9KZH1TLOoMrDyArjlH+4mDkMt2GpfGePASjt\r
+       CbupNXRk6DKXz/pz3qM9un4dr7zQZ1RxKDIGhAWl+zjWMjdmy3qh1U5e6IXAaAeiMt1z\r
+       YNBXzPkfPXaltLYELcDJgQRFJBbRqH++ur1cIRF24ZkM0e4WwwUPHItzaKRud9OJ2YxQ\r
+       dVPw==\r
+Received: by 10.68.239.164 with SMTP id vt4mr707205pbc.118.1344151366868;\r
+       Sun, 05 Aug 2012 00:22:46 -0700 (PDT)\r
+Received: from localhost (215.42.233.220.static.exetel.com.au.\r
+       [220.233.42.215])\r
+       by mx.google.com with ESMTPS id pi7sm6403699pbb.56.2012.08.05.00.22.43\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sun, 05 Aug 2012 00:22:46 -0700 (PDT)\r
+From: Peter Wang <novalazy@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/4] test: conform to content-length fields (json)\r
+Date: Sun,  5 Aug 2012 17:22:23 +1000\r
+Message-Id: <1344151345-25411-2-git-send-email-novalazy@gmail.com>\r
+X-Mailer: git-send-email 1.7.4.4\r
+In-Reply-To: <1344151345-25411-1-git-send-email-novalazy@gmail.com>\r
+References: <1344151345-25411-1-git-send-email-novalazy@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 05 Aug 2012 07:22:58 -0000\r
+\r
+Update tests to expect content-length fields in show --format=json\r
+output, for leaf parts with omitted body content.\r
+---\r
+ test/crypto    |   25 +++++++++++++++++--------\r
+ test/json      |    2 +-\r
+ test/multipart |    9 +++++----\r
+ 3 files changed, 23 insertions(+), 13 deletions(-)\r
+\r
+diff --git a/test/crypto b/test/crypto\r
+index 5dd14c4..4a73dcc 100755\r
+--- a/test/crypto\r
++++ b/test/crypto\r
+@@ -61,7 +61,8 @@ expected='[[[{"id": "XXXXX",\r
+  "content-type": "text/plain",\r
+  "content": "This is a test signed message.\n"},\r
+  {"id": 3,\r
+- "content-type": "application/pgp-signature"}]}]},\r
++ "content-type": "application/pgp-signature",\r
++ "content-length": 315}]}]},\r
+  []]]]'\r
+ test_expect_equal_json \\r
+     "$output" \\r
+@@ -95,7 +96,8 @@ expected='[[[{"id": "XXXXX",\r
+  "content-type": "text/plain",\r
+  "content": "This is a test signed message.\n"},\r
+  {"id": 3,\r
+- "content-type": "application/pgp-signature"}]}]},\r
++ "content-type": "application/pgp-signature",\r
++ "content-length": 315}]}]},\r
+  []]]]'\r
+ test_expect_equal_json \\r
+     "$output" \\r
+@@ -127,7 +129,8 @@ expected='[[[{"id": "XXXXX",\r
+  "content-type": "text/plain",\r
+  "content": "This is a test signed message.\n"},\r
+  {"id": 3,\r
+- "content-type": "application/pgp-signature"}]}]},\r
++ "content-type": "application/pgp-signature",\r
++ "content-length": 315}]}]},\r
+  []]]]'\r
+ test_expect_equal_json \\r
+     "$output" \\r
+@@ -196,7 +199,8 @@ expected='[[[{"id": "XXXXX",\r
+  "sigstatus": [],\r
+  "content-type": "multipart/encrypted",\r
+  "content": [{"id": 2,\r
+- "content-type": "application/pgp-encrypted"},\r
++ "content-type": "application/pgp-encrypted",\r
++ "content-length": 11},\r
+  {"id": 3,\r
+  "content-type": "multipart/mixed",\r
+  "content": [{"id": 4,\r
+@@ -204,6 +208,7 @@ expected='[[[{"id": "XXXXX",\r
+  "content": "This is a test encrypted message.\n"},\r
+  {"id": 5,\r
+  "content-type": "application/octet-stream",\r
++ "content-length": 28,\r
+  "filename": "TESTATTACHMENT"}]}]}]},\r
+  []]]]'\r
+ test_expect_equal_json \\r
+@@ -249,9 +254,11 @@ expected='[[[{"id": "XXXXX",\r
+  "encstatus": [{"status": "bad"}],\r
+  "content-type": "multipart/encrypted",\r
+  "content": [{"id": 2,\r
+- "content-type": "application/pgp-encrypted"},\r
++ "content-type": "application/pgp-encrypted",\r
++ "content-length": 11},\r
+  {"id": 3,\r
+- "content-type": "application/octet-stream"}]}]},\r
++ "content-type": "application/octet-stream",\r
++ "content-length": 652}]}]},\r
+  []]]]'\r
+ test_expect_equal_json \\r
+     "$output" \\r
+@@ -287,7 +294,8 @@ expected='[[[{"id": "XXXXX",\r
+  "userid": " Notmuch Test Suite <test_suite@notmuchmail.org> (INSECURE!)"}],\r
+  "content-type": "multipart/encrypted",\r
+  "content": [{"id": 2,\r
+- "content-type": "application/pgp-encrypted"},\r
++ "content-type": "application/pgp-encrypted",\r
++ "content-length": 11},\r
+  {"id": 3,\r
+  "content-type": "text/plain",\r
+  "content": "This is another test encrypted message.\n"}]}]},\r
+@@ -342,7 +350,8 @@ expected='[[[{"id": "XXXXX",\r
+  "content-type": "text/plain",\r
+  "content": "This is a test signed message.\n"},\r
+  {"id": 3,\r
+- "content-type": "application/pgp-signature"}]}]},\r
++ "content-type": "application/pgp-signature",\r
++ "content-length": 315}]}]},\r
+  []]]]'\r
+ test_expect_equal_json \\r
+     "$output" \\r
+diff --git a/test/json b/test/json\r
+index ac8fa8e..ff2287e 100755\r
+--- a/test/json\r
++++ b/test/json\r
+@@ -45,7 +45,7 @@ emacs_deliver_message \\r
+      (insert \"Message-ID: <$id>\n\")"\r
+ output=$(notmuch show --format=json "id:$id")\r
+ filename=$(notmuch search --output=files "id:$id")\r
+-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\"}]}]}, []]]]"\r
++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\"}]}]}, []]]]"\r
\r
+ test_begin_subtest "Search message: json, utf-8"\r
+ 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\""\r
+diff --git a/test/multipart b/test/multipart\r
+index 0527f84..0f9e113 100755\r
+--- a/test/multipart\r
++++ b/test/multipart\r
+@@ -330,7 +330,7 @@ cat <<EOF >EXPECTED\r
+ {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, \r
+ {"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, \r
+ {"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, \r
+-{"id": 9, "content-type": "application/pgp-signature"}]}]}\r
++{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}]}]}\r
+ EOF\r
+ test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
\r
+@@ -345,7 +345,7 @@ cat <<EOF >EXPECTED\r
+ {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, \r
+ {"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, \r
+ {"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, \r
+-{"id": 9, "content-type": "application/pgp-signature"}]}\r
++{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}]}\r
+ EOF\r
+ test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
\r
+@@ -412,7 +412,7 @@ test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
+ test_begin_subtest "--format=json --part=9, pgp signature (unverified)"\r
+ notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
+ cat <<EOF >EXPECTED\r
+-{"id": 9, "content-type": "application/pgp-signature"}\r
++{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}\r
+ EOF\r
+ test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
\r
+@@ -636,7 +636,8 @@ cat <<EOF >EXPECTED\r
+  "content-type": "text/plain",\r
+  "content": "And this message is signed.\n\n-Carl\n"}]},\r
+  {"id": 9,\r
+- "content-type": "application/pgp-signature"}]}]}}\r
++ "content-type": "application/pgp-signature",\r
++ "content-length": 197}]}]}}\r
+ EOF\r
+ test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
\r
+-- \r
+1.7.4.4\r
+\r