2 test_description="\"notmuch reply\" in several variations"
5 test_begin_subtest "Basic reply"
6 add_message '[from]="Sender <sender@example.com>"' \
7 [to]=test_suite@notmuchmail.org \
8 [subject]=notmuch-reply-test \
9 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
10 '[body]="basic reply test"'
12 output=$(notmuch reply id:${gen_msg_id})
13 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
14 Subject: Re: notmuch-reply-test
15 To: Sender <sender@example.com>
16 In-Reply-To: <${gen_msg_id}>
17 References: <${gen_msg_id}>
19 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
22 test_begin_subtest "Multiple recipients"
23 add_message '[from]="Sender <sender@example.com>"' \
24 '[to]="test_suite@notmuchmail.org, Someone Else <someone@example.com>"' \
25 [subject]=notmuch-reply-test \
26 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
27 '[body]="Multiple recipients"'
29 output=$(notmuch reply id:${gen_msg_id})
30 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
31 Subject: Re: notmuch-reply-test
32 To: Sender <sender@example.com>, Someone Else <someone@example.com>
33 In-Reply-To: <${gen_msg_id}>
34 References: <${gen_msg_id}>
36 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
37 > Multiple recipients"
39 test_begin_subtest "Reply with CC"
40 add_message '[from]="Sender <sender@example.com>"' \
41 [to]=test_suite@notmuchmail.org \
42 '[cc]="Other Parties <cc@example.com>"' \
43 [subject]=notmuch-reply-test \
44 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
45 '[body]="reply with CC"'
47 output=$(notmuch reply id:${gen_msg_id})
48 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
49 Subject: Re: notmuch-reply-test
50 To: Sender <sender@example.com>
51 Cc: Other Parties <cc@example.com>
52 In-Reply-To: <${gen_msg_id}>
53 References: <${gen_msg_id}>
55 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
58 test_begin_subtest "Reply from alternate address"
59 add_message '[from]="Sender <sender@example.com>"' \
60 [to]=test_suite_other@notmuchmail.org \
61 [subject]=notmuch-reply-test \
62 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
63 '[body]="reply from alternate address"'
65 output=$(notmuch reply id:${gen_msg_id})
66 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
67 Subject: Re: notmuch-reply-test
68 To: Sender <sender@example.com>
69 In-Reply-To: <${gen_msg_id}>
70 References: <${gen_msg_id}>
72 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
73 > reply from alternate address"
75 test_begin_subtest "Reply from address in named group list"
76 add_message '[from]="Sender <sender@example.com>"' \
77 '[to]=group:test_suite@notmuchmail.org,someone@example.com\;' \
78 [cc]=test_suite_other@notmuchmail.org \
79 [subject]=notmuch-reply-test \
80 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
81 '[body]="Reply from address in named group list"'
83 output=$(notmuch reply id:${gen_msg_id})
84 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
85 Subject: Re: notmuch-reply-test
86 To: Sender <sender@example.com>, someone@example.com
87 In-Reply-To: <${gen_msg_id}>
88 References: <${gen_msg_id}>
90 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
91 > Reply from address in named group list"
93 test_begin_subtest "Support for Reply-To"
94 add_message '[from]="Sender <sender@example.com>"' \
95 [to]=test_suite@notmuchmail.org \
96 [subject]=notmuch-reply-test \
97 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
98 '[body]="support for reply-to"' \
99 '[reply-to]="Sender <elsewhere@example.com>"'
101 output=$(notmuch reply id:${gen_msg_id})
102 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
103 Subject: Re: notmuch-reply-test
104 To: Sender <elsewhere@example.com>
105 In-Reply-To: <${gen_msg_id}>
106 References: <${gen_msg_id}>
108 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
109 > support for reply-to"
111 test_begin_subtest "Un-munging Reply-To"
112 add_message '[from]="Sender <sender@example.com>"' \
113 '[to]="Some List <list@example.com>"' \
114 [subject]=notmuch-reply-test \
115 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
116 '[body]="Un-munging Reply-To"' \
117 '[reply-to]="Evil Munging List <list@example.com>"'
119 output=$(notmuch reply id:${gen_msg_id})
120 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
121 Subject: Re: notmuch-reply-test
122 To: Sender <sender@example.com>, Some List <list@example.com>
123 In-Reply-To: <${gen_msg_id}>
124 References: <${gen_msg_id}>
126 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
127 > Un-munging Reply-To"
129 test_begin_subtest "Message with header of exactly 200 bytes"
130 add_message '[subject]="This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces"' \
131 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
132 '[body]="200-byte header"'
133 output=$(notmuch reply id:${gen_msg_id})
134 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
135 Subject: Re: This subject is exactly 200 bytes in length. Other than its
136 length there is not much of note here. Note that the length of 200 bytes
137 includes the Subject: and Re: prefixes with two spaces
138 In-Reply-To: <${gen_msg_id}>
139 References: <${gen_msg_id}>
141 On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
144 test_begin_subtest "From guessing: Envelope-To"
145 add_message '[from]="Sender <sender@example.com>"' \
146 '[to]="Recipient <recipient@example.com>"' \
147 '[subject]="From guessing"' \
148 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
149 '[body]="From guessing"' \
150 '[header]="Envelope-To: test_suite_other@notmuchmail.org"'
152 output=$(notmuch reply id:${gen_msg_id})
153 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
154 Subject: Re: From guessing
155 To: Sender <sender@example.com>, Recipient <recipient@example.com>
156 In-Reply-To: <${gen_msg_id}>
157 References: <${gen_msg_id}>
159 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
162 test_begin_subtest "From guessing: X-Original-To"
163 add_message '[from]="Sender <sender@example.com>"' \
164 '[to]="Recipient <recipient@example.com>"' \
165 '[subject]="From guessing"' \
166 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
167 '[body]="From guessing"' \
168 '[header]="X-Original-To: test_suite@otherdomain.org"'
170 output=$(notmuch reply id:${gen_msg_id})
171 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@otherdomain.org>
172 Subject: Re: From guessing
173 To: Sender <sender@example.com>, Recipient <recipient@example.com>
174 In-Reply-To: <${gen_msg_id}>
175 References: <${gen_msg_id}>
177 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
180 test_begin_subtest "From guessing: Delivered-To"
181 add_message '[from]="Sender <sender@example.com>"' \
182 '[to]="Recipient <recipient@example.com>"' \
183 '[subject]="From guessing"' \
184 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
185 '[body]="From guessing"' \
186 '[header]="Delivered-To: test_suite_other@notmuchmail.org"'
188 output=$(notmuch reply id:${gen_msg_id})
189 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
190 Subject: Re: From guessing
191 To: Sender <sender@example.com>, Recipient <recipient@example.com>
192 In-Reply-To: <${gen_msg_id}>
193 References: <${gen_msg_id}>
195 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
198 test_begin_subtest "Reply with RFC 2047-encoded headers"
199 add_message '[subject]="=?iso-8859-1?q?=e0=df=e7?="' \
200 '[from]="=?utf-8?q?=e2=98=83?= <snowman@example.com>"' \
201 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
204 # GMime happens to change from Q- to B-encoding. We canonicalize the
205 # case of the encoding and charset because different versions of GMime
206 # capitalize the encoding differently.
207 output=$(notmuch reply id:${gen_msg_id} | perl -pe 's/=\?[^?]+\?[bB]\?/lc($&)/ge')
208 test_expect_equal "$output" "\
209 From: Notmuch Test Suite <test_suite@notmuchmail.org>
210 Subject: Re: =?iso-8859-1?b?4N/n?=
211 To: =?utf-8?b?4piD?= <snowman@example.com>
212 In-Reply-To: <${gen_msg_id}>
213 References: <${gen_msg_id}>
215 On Tue, 05 Jan 2010 15:43:56 -0000, ☃ <snowman@example.com> wrote:
218 test_begin_subtest "Reply with RFC 2047-encoded headers (JSON)"
219 output=$(notmuch reply --format=json id:${gen_msg_id})
220 test_expect_equal_json "$output" '
225 "content": "Encoding\n",
226 "content-type": "text/plain",
230 "date_relative": "2010-01-05",
232 "filename": "'${MAIL_DIR}'/msg-012",
234 "Date": "Tue, 05 Jan 2010 15:43:56 +0000",
235 "From": "\u2603 <snowman@example.com>",
236 "Subject": "\u00e0\u00df\u00e7",
237 "To": "Notmuch Test Suite <test_suite@notmuchmail.org>"
239 "id": "'${gen_msg_id}'",
245 "timestamp": 1262706236
248 "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
249 "In-reply-to": "<'${gen_msg_id}'>",
250 "References": "<'${gen_msg_id}'>",
251 "Subject": "Re: \u00e0\u00df\u00e7",
252 "To": "\u2603 <snowman@example.com>"