Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / e7 / cb2368716c2dad3d16aa9d8ea6580e765bf2c7
1 Return-Path: <novalazy@gmail.com>\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 C4277429E2E\r
6         for <notmuch@notmuchmail.org>; Wed,  8 Aug 2012 05:28:44 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 ERUeKZe7fOTT for <notmuch@notmuchmail.org>;\r
17         Wed,  8 Aug 2012 05:28:41 -0700 (PDT)\r
18 Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com\r
19         [209.85.160.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 2E59A431FC4\r
22         for <notmuch@notmuchmail.org>; Wed,  8 Aug 2012 05:28:32 -0700 (PDT)\r
23 Received: by pbbro2 with SMTP id ro2so1721964pbb.26\r
24         for <notmuch@notmuchmail.org>; Wed, 08 Aug 2012 05:28:30 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
27         :mime-version:content-type:content-transfer-encoding;\r
28         bh=7ct9gJiKLEp0QBxGI6M8OCXSuY8zLroqce9Tgp5w1zg=;\r
29         b=gnEXm4wGb78rBuoSy11sp2zx+DIZ875RmIwJ3SAzjCn/inEffw4qEsrJcgz8SZ3vdJ\r
30         oT8WDSB/fczticViIR1lfAvxv8nICOqSBOJDcaKZX2dkoVOTYlLTxmcRV8l/WZeIPlg3\r
31         7KAiQ8vwK3iejhMB7N1v4lkoFEcgR6EB7uvKHa7LsTC+66JF6O8aozG+ztUeC0PYyLdM\r
32         VbH9/R/OKnBCH+qJ6kE8N5vYqZyCwGDLJXEL5XqeVHKgVY67/CdvColonVBNg7Lhpyt+\r
33         eLd1tkC5tO87SUhqxYuh9uIijUSF2sq7GV8r3RbEXP46xCD1ef4gQnjPIljihqLN6Fu4\r
34         3i4Q==\r
35 Received: by 10.68.222.167 with SMTP id qn7mr35875794pbc.98.1344428910131;\r
36         Wed, 08 Aug 2012 05:28:30 -0700 (PDT)\r
37 Received: from localhost (215.42.233.220.static.exetel.com.au.\r
38         [220.233.42.215])\r
39         by mx.google.com with ESMTPS id ng8sm13320302pbc.13.2012.08.08.05.28.27\r
40         (version=TLSv1/SSLv3 cipher=OTHER);\r
41         Wed, 08 Aug 2012 05:28:29 -0700 (PDT)\r
42 From: Peter Wang <novalazy@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH v2 3/3] test: conform to content length, encoding fields\r
45 Date: Wed,  8 Aug 2012 22:27:52 +1000\r
46 Message-Id: <1344428872-12374-4-git-send-email-novalazy@gmail.com>\r
47 X-Mailer: git-send-email 1.7.4.4\r
48 In-Reply-To: <1344428872-12374-1-git-send-email-novalazy@gmail.com>\r
49 References: <1344428872-12374-1-git-send-email-novalazy@gmail.com>\r
50 MIME-Version: 1.0\r
51 Content-Type: text/plain; charset=UTF-8\r
52 Content-Transfer-Encoding: 8bit\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Wed, 08 Aug 2012 12:28:45 -0000\r
66 \r
67 Update tests to expect content-length and content-transfer-encoding\r
68 fields in show --format=json output, for leaf parts with omitted body\r
69 content.\r
70 ---\r
71  test/crypto    |   30 +++++++++++++++++++++---------\r
72  test/json      |    2 +-\r
73  test/multipart |    9 +++++----\r
74  3 files changed, 27 insertions(+), 14 deletions(-)\r
75 \r
76 diff --git a/test/crypto b/test/crypto\r
77 index 5dd14c4..aa96ec2 100755\r
78 --- a/test/crypto\r
79 +++ b/test/crypto\r
80 @@ -61,7 +61,8 @@ expected='[[[{"id": "XXXXX",\r
81   "content-type": "text/plain",\r
82   "content": "This is a test signed message.\n"},\r
83   {"id": 3,\r
84 - "content-type": "application/pgp-signature"}]}]},\r
85 + "content-type": "application/pgp-signature",\r
86 + "content-length": 315}]}]},\r
87   []]]]'\r
88  test_expect_equal_json \\r
89      "$output" \\r
90 @@ -95,7 +96,8 @@ expected='[[[{"id": "XXXXX",\r
91   "content-type": "text/plain",\r
92   "content": "This is a test signed message.\n"},\r
93   {"id": 3,\r
94 - "content-type": "application/pgp-signature"}]}]},\r
95 + "content-type": "application/pgp-signature",\r
96 + "content-length": 315}]}]},\r
97   []]]]'\r
98  test_expect_equal_json \\r
99      "$output" \\r
100 @@ -127,7 +129,8 @@ expected='[[[{"id": "XXXXX",\r
101   "content-type": "text/plain",\r
102   "content": "This is a test signed message.\n"},\r
103   {"id": 3,\r
104 - "content-type": "application/pgp-signature"}]}]},\r
105 + "content-type": "application/pgp-signature",\r
106 + "content-length": 315}]}]},\r
107   []]]]'\r
108  test_expect_equal_json \\r
109      "$output" \\r
110 @@ -196,7 +199,8 @@ expected='[[[{"id": "XXXXX",\r
111   "sigstatus": [],\r
112   "content-type": "multipart/encrypted",\r
113   "content": [{"id": 2,\r
114 - "content-type": "application/pgp-encrypted"},\r
115 + "content-type": "application/pgp-encrypted",\r
116 + "content-length": 11},\r
117   {"id": 3,\r
118   "content-type": "multipart/mixed",\r
119   "content": [{"id": 4,\r
120 @@ -204,6 +208,8 @@ expected='[[[{"id": "XXXXX",\r
121   "content": "This is a test encrypted message.\n"},\r
122   {"id": 5,\r
123   "content-type": "application/octet-stream",\r
124 + "content-length": 28,\r
125 + "content-transfer-encoding": "base64",\r
126   "filename": "TESTATTACHMENT"}]}]}]},\r
127   []]]]'\r
128  test_expect_equal_json \\r
129 @@ -231,9 +237,11 @@ test_expect_equal_file OUTPUT TESTATTACHMENT\r
130  \r
131  test_begin_subtest "decryption failure with missing key"\r
132  mv "${GNUPGHOME}"{,.bak}\r
133 +# The length of the encrypted attachment varies so must be normalized.\r
134  output=$(notmuch show --format=json --decrypt subject:"test encrypted message 001" \\r
135      | notmuch_json_show_sanitize \\r
136 -    | sed -e 's|"created": [1234567890]*|"created": 946728000|')\r
137 +    | sed -e 's|"created": [1234567890]*|"created": 946728000|' \\r
138 +    | sed -e 's|"content-length": 6[1234567890]*|"content-length": 652|')\r
139  expected='[[[{"id": "XXXXX",\r
140   "match": true,\r
141   "excluded": false,\r
142 @@ -249,9 +257,11 @@ expected='[[[{"id": "XXXXX",\r
143   "encstatus": [{"status": "bad"}],\r
144   "content-type": "multipart/encrypted",\r
145   "content": [{"id": 2,\r
146 - "content-type": "application/pgp-encrypted"},\r
147 + "content-type": "application/pgp-encrypted",\r
148 + "content-length": 11},\r
149   {"id": 3,\r
150 - "content-type": "application/octet-stream"}]}]},\r
151 + "content-type": "application/octet-stream",\r
152 + "content-length": 652}]}]},\r
153   []]]]'\r
154  test_expect_equal_json \\r
155      "$output" \\r
156 @@ -287,7 +297,8 @@ expected='[[[{"id": "XXXXX",\r
157   "userid": " Notmuch Test Suite <test_suite@notmuchmail.org> (INSECURE!)"}],\r
158   "content-type": "multipart/encrypted",\r
159   "content": [{"id": 2,\r
160 - "content-type": "application/pgp-encrypted"},\r
161 + "content-type": "application/pgp-encrypted",\r
162 + "content-length": 11},\r
163   {"id": 3,\r
164   "content-type": "text/plain",\r
165   "content": "This is another test encrypted message.\n"}]}]},\r
166 @@ -342,7 +353,8 @@ expected='[[[{"id": "XXXXX",\r
167   "content-type": "text/plain",\r
168   "content": "This is a test signed message.\n"},\r
169   {"id": 3,\r
170 - "content-type": "application/pgp-signature"}]}]},\r
171 + "content-type": "application/pgp-signature",\r
172 + "content-length": 315}]}]},\r
173   []]]]'\r
174  test_expect_equal_json \\r
175      "$output" \\r
176 diff --git a/test/json b/test/json\r
177 index ac8fa8e..8ce2e8a 100755\r
178 --- a/test/json\r
179 +++ b/test/json\r
180 @@ -45,7 +45,7 @@ emacs_deliver_message \\r
181       (insert \"Message-ID: <$id>\n\")"\r
182  output=$(notmuch show --format=json "id:$id")\r
183  filename=$(notmuch search --output=files "id:$id")\r
184 -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
185 +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, \"content-transfer-encoding\": \"base64\", \"filename\": \"README\"}]}]}, []]]]"\r
186  \r
187  test_begin_subtest "Search message: json, utf-8"\r
188  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
189 diff --git a/test/multipart b/test/multipart\r
190 index 344ed81..497f3ec 100755\r
191 --- a/test/multipart\r
192 +++ b/test/multipart\r
193 @@ -330,7 +330,7 @@ cat <<EOF >EXPECTED\r
194  {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, \r
195  {"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, \r
196  {"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, \r
197 -{"id": 9, "content-type": "application/pgp-signature"}]}]}\r
198 +{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}]}]}\r
199  EOF\r
200  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
201  \r
202 @@ -345,7 +345,7 @@ cat <<EOF >EXPECTED\r
203  {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, \r
204  {"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, \r
205  {"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, \r
206 -{"id": 9, "content-type": "application/pgp-signature"}]}\r
207 +{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}]}\r
208  EOF\r
209  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
210  \r
211 @@ -412,7 +412,7 @@ test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
212  test_begin_subtest "--format=json --part=9, pgp signature (unverified)"\r
213  notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
214  cat <<EOF >EXPECTED\r
215 -{"id": 9, "content-type": "application/pgp-signature"}\r
216 +{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}\r
217  EOF\r
218  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
219  \r
220 @@ -636,7 +636,8 @@ cat <<EOF >EXPECTED\r
221   "content-type": "text/plain",\r
222   "content": "And this message is signed.\n\n-Carl\n"}]},\r
223   {"id": 9,\r
224 - "content-type": "application/pgp-signature"}]}]}}\r
225 + "content-type": "application/pgp-signature",\r
226 + "content-length": 197}]}]}}\r
227  EOF\r
228  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
229  \r
230 -- \r
231 1.7.4.4\r
232 \r