Re: [PATCH] test: test folder renames
[notmuch-archives.git] / 4c / 34a407071fe978c4ec04f4a720d40cfb5e6f02
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 60C6C431FBF\r
6         for <notmuch@notmuchmail.org>; Sun,  5 Aug 2012 00:22:58 -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 WuDIodp+6Y9Z for <notmuch@notmuchmail.org>;\r
17         Sun,  5 Aug 2012 00:22:56 -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 13DE0431FB6\r
22         for <notmuch@notmuchmail.org>; Sun,  5 Aug 2012 00:22:47 -0700 (PDT)\r
23 Received: by mail-pb0-f53.google.com with SMTP id ro8so3935886pbb.26\r
24         for <notmuch@notmuchmail.org>; Sun, 05 Aug 2012 00:22:46 -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=uG4z+lTiI9253NJDkCc+U5QlIeLdCCa3yN6hNnzRJME=;\r
29         b=QOc/Aj7W5qL41WLGtO+T/W9A28HapXTsafEF7VyiBSjNoW0tHU9YSP9GkH/Rs2hg8m\r
30         PrK1fP2rOszbCM7VHRrQGaNRIEM0xjv7yr5Pj8oWZ/w8nY6fYWmIv6SbweTEu1uXFR4B\r
31         Yo69GWLoLC7Ur4g/Jmq+Yf9dIuDfnjUl9KZH1TLOoMrDyArjlH+4mDkMt2GpfGePASjt\r
32         CbupNXRk6DKXz/pz3qM9un4dr7zQZ1RxKDIGhAWl+zjWMjdmy3qh1U5e6IXAaAeiMt1z\r
33         YNBXzPkfPXaltLYELcDJgQRFJBbRqH++ur1cIRF24ZkM0e4WwwUPHItzaKRud9OJ2YxQ\r
34         dVPw==\r
35 Received: by 10.68.239.164 with SMTP id vt4mr707205pbc.118.1344151366868;\r
36         Sun, 05 Aug 2012 00:22:46 -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 pi7sm6403699pbb.56.2012.08.05.00.22.43\r
40         (version=TLSv1/SSLv3 cipher=OTHER);\r
41         Sun, 05 Aug 2012 00:22:46 -0700 (PDT)\r
42 From: Peter Wang <novalazy@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH 2/4] test: conform to content-length fields (json)\r
45 Date: Sun,  5 Aug 2012 17:22:23 +1000\r
46 Message-Id: <1344151345-25411-2-git-send-email-novalazy@gmail.com>\r
47 X-Mailer: git-send-email 1.7.4.4\r
48 In-Reply-To: <1344151345-25411-1-git-send-email-novalazy@gmail.com>\r
49 References: <1344151345-25411-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: Sun, 05 Aug 2012 07:22:58 -0000\r
66 \r
67 Update tests to expect content-length fields in show --format=json\r
68 output, for leaf parts with omitted body content.\r
69 ---\r
70  test/crypto    |   25 +++++++++++++++++--------\r
71  test/json      |    2 +-\r
72  test/multipart |    9 +++++----\r
73  3 files changed, 23 insertions(+), 13 deletions(-)\r
74 \r
75 diff --git a/test/crypto b/test/crypto\r
76 index 5dd14c4..4a73dcc 100755\r
77 --- a/test/crypto\r
78 +++ b/test/crypto\r
79 @@ -61,7 +61,8 @@ expected='[[[{"id": "XXXXX",\r
80   "content-type": "text/plain",\r
81   "content": "This is a test signed message.\n"},\r
82   {"id": 3,\r
83 - "content-type": "application/pgp-signature"}]}]},\r
84 + "content-type": "application/pgp-signature",\r
85 + "content-length": 315}]}]},\r
86   []]]]'\r
87  test_expect_equal_json \\r
88      "$output" \\r
89 @@ -95,7 +96,8 @@ expected='[[[{"id": "XXXXX",\r
90   "content-type": "text/plain",\r
91   "content": "This is a test signed message.\n"},\r
92   {"id": 3,\r
93 - "content-type": "application/pgp-signature"}]}]},\r
94 + "content-type": "application/pgp-signature",\r
95 + "content-length": 315}]}]},\r
96   []]]]'\r
97  test_expect_equal_json \\r
98      "$output" \\r
99 @@ -127,7 +129,8 @@ expected='[[[{"id": "XXXXX",\r
100   "content-type": "text/plain",\r
101   "content": "This is a test signed message.\n"},\r
102   {"id": 3,\r
103 - "content-type": "application/pgp-signature"}]}]},\r
104 + "content-type": "application/pgp-signature",\r
105 + "content-length": 315}]}]},\r
106   []]]]'\r
107  test_expect_equal_json \\r
108      "$output" \\r
109 @@ -196,7 +199,8 @@ expected='[[[{"id": "XXXXX",\r
110   "sigstatus": [],\r
111   "content-type": "multipart/encrypted",\r
112   "content": [{"id": 2,\r
113 - "content-type": "application/pgp-encrypted"},\r
114 + "content-type": "application/pgp-encrypted",\r
115 + "content-length": 11},\r
116   {"id": 3,\r
117   "content-type": "multipart/mixed",\r
118   "content": [{"id": 4,\r
119 @@ -204,6 +208,7 @@ expected='[[[{"id": "XXXXX",\r
120   "content": "This is a test encrypted message.\n"},\r
121   {"id": 5,\r
122   "content-type": "application/octet-stream",\r
123 + "content-length": 28,\r
124   "filename": "TESTATTACHMENT"}]}]}]},\r
125   []]]]'\r
126  test_expect_equal_json \\r
127 @@ -249,9 +254,11 @@ expected='[[[{"id": "XXXXX",\r
128   "encstatus": [{"status": "bad"}],\r
129   "content-type": "multipart/encrypted",\r
130   "content": [{"id": 2,\r
131 - "content-type": "application/pgp-encrypted"},\r
132 + "content-type": "application/pgp-encrypted",\r
133 + "content-length": 11},\r
134   {"id": 3,\r
135 - "content-type": "application/octet-stream"}]}]},\r
136 + "content-type": "application/octet-stream",\r
137 + "content-length": 652}]}]},\r
138   []]]]'\r
139  test_expect_equal_json \\r
140      "$output" \\r
141 @@ -287,7 +294,8 @@ expected='[[[{"id": "XXXXX",\r
142   "userid": " Notmuch Test Suite <test_suite@notmuchmail.org> (INSECURE!)"}],\r
143   "content-type": "multipart/encrypted",\r
144   "content": [{"id": 2,\r
145 - "content-type": "application/pgp-encrypted"},\r
146 + "content-type": "application/pgp-encrypted",\r
147 + "content-length": 11},\r
148   {"id": 3,\r
149   "content-type": "text/plain",\r
150   "content": "This is another test encrypted message.\n"}]}]},\r
151 @@ -342,7 +350,8 @@ expected='[[[{"id": "XXXXX",\r
152   "content-type": "text/plain",\r
153   "content": "This is a test signed message.\n"},\r
154   {"id": 3,\r
155 - "content-type": "application/pgp-signature"}]}]},\r
156 + "content-type": "application/pgp-signature",\r
157 + "content-length": 315}]}]},\r
158   []]]]'\r
159  test_expect_equal_json \\r
160      "$output" \\r
161 diff --git a/test/json b/test/json\r
162 index ac8fa8e..ff2287e 100755\r
163 --- a/test/json\r
164 +++ b/test/json\r
165 @@ -45,7 +45,7 @@ emacs_deliver_message \\r
166       (insert \"Message-ID: <$id>\n\")"\r
167  output=$(notmuch show --format=json "id:$id")\r
168  filename=$(notmuch search --output=files "id:$id")\r
169 -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
170 +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
171  \r
172  test_begin_subtest "Search message: json, utf-8"\r
173  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
174 diff --git a/test/multipart b/test/multipart\r
175 index 0527f84..0f9e113 100755\r
176 --- a/test/multipart\r
177 +++ b/test/multipart\r
178 @@ -330,7 +330,7 @@ cat <<EOF >EXPECTED\r
179  {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, \r
180  {"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, \r
181  {"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, \r
182 -{"id": 9, "content-type": "application/pgp-signature"}]}]}\r
183 +{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}]}]}\r
184  EOF\r
185  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
186  \r
187 @@ -345,7 +345,7 @@ cat <<EOF >EXPECTED\r
188  {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, \r
189  {"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, \r
190  {"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, \r
191 -{"id": 9, "content-type": "application/pgp-signature"}]}\r
192 +{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}]}\r
193  EOF\r
194  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
195  \r
196 @@ -412,7 +412,7 @@ test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
197  test_begin_subtest "--format=json --part=9, pgp signature (unverified)"\r
198  notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
199  cat <<EOF >EXPECTED\r
200 -{"id": 9, "content-type": "application/pgp-signature"}\r
201 +{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}\r
202  EOF\r
203  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
204  \r
205 @@ -636,7 +636,8 @@ cat <<EOF >EXPECTED\r
206   "content-type": "text/plain",\r
207   "content": "And this message is signed.\n\n-Carl\n"}]},\r
208   {"id": 9,\r
209 - "content-type": "application/pgp-signature"}]}]}}\r
210 + "content-type": "application/pgp-signature",\r
211 + "content-length": 197}]}]}}\r
212  EOF\r
213  test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"\r
214  \r
215 -- \r
216 1.7.4.4\r
217 \r