]> git.cworth.org Git - obsolete/notmuch-old/blob - test/reply
reply: Remove extraneous space from generated References
[obsolete/notmuch-old] / test / reply
1 #!/usr/bin/env bash
2 test_description="\"notmuch reply\" in several variations"
3 . ./test-lib.sh
4
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"'
11
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}>
18
19 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
20 > basic reply test"
21
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"'
28
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}>
35
36 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
37 > Multiple recipients"
38
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"'
46
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}>
54
55 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
56 > reply with CC"
57
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"'
64
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}>
71
72 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
73 > reply from alternate address"
74
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"'
82
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}>
89
90 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
91 > Reply from address in named group list"
92
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>"'
100
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}>
107
108 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
109 > support for reply-to"
110
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>"'
118
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}>
125
126 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
127 > Un-munging Reply-To"
128
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 length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces
136 In-Reply-To: <${gen_msg_id}>
137 References: <${gen_msg_id}>
138
139 On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
140 > 200-byte header"
141
142 test_begin_subtest "From guessing: Envelope-To"
143 add_message '[from]="Sender <sender@example.com>"' \
144             '[to]="Recipient <recipient@example.com>"' \
145             '[subject]="From guessing"' \
146             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
147             '[body]="From guessing"' \
148             '[header]="Envelope-To: test_suite_other@notmuchmail.org"'
149
150 output=$(notmuch reply id:${gen_msg_id})
151 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
152 Subject: Re: From guessing
153 To: Sender <sender@example.com>, Recipient <recipient@example.com>
154 In-Reply-To: <${gen_msg_id}>
155 References: <${gen_msg_id}>
156
157 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
158 > From guessing"
159
160 test_begin_subtest "From guessing: X-Original-To"
161 add_message '[from]="Sender <sender@example.com>"' \
162             '[to]="Recipient <recipient@example.com>"' \
163             '[subject]="From guessing"' \
164             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
165             '[body]="From guessing"' \
166             '[header]="X-Original-To: test_suite@otherdomain.org"'
167
168 output=$(notmuch reply id:${gen_msg_id})
169 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@otherdomain.org>
170 Subject: Re: From guessing
171 To: Sender <sender@example.com>, Recipient <recipient@example.com>
172 In-Reply-To: <${gen_msg_id}>
173 References: <${gen_msg_id}>
174
175 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
176 > From guessing"
177
178 test_begin_subtest "From guessing: Delivered-To"
179 add_message '[from]="Sender <sender@example.com>"' \
180             '[to]="Recipient <recipient@example.com>"' \
181             '[subject]="From guessing"' \
182             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
183             '[body]="From guessing"' \
184             '[header]="Delivered-To: test_suite_other@notmuchmail.org"'
185
186 output=$(notmuch reply id:${gen_msg_id})
187 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
188 Subject: Re: From guessing
189 To: Sender <sender@example.com>, Recipient <recipient@example.com>
190 In-Reply-To: <${gen_msg_id}>
191 References: <${gen_msg_id}>
192
193 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
194 > From guessing"
195
196 test_begin_subtest "Reply with RFC 2047-encoded headers"
197 add_message '[subject]="=?iso-8859-1?q?=e0=df=e7?="' \
198             '[from]="=?utf-8?q?=e2=98=83?= <snowman@example.com>"' \
199             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
200             '[body]="Encoding"'
201
202 output=$(notmuch reply id:${gen_msg_id})
203 test_expect_equal "$output" "\
204 From: Notmuch Test Suite <test_suite@notmuchmail.org>
205 Subject: Re: àßç
206 To: ☃ <snowman@example.com>
207 In-Reply-To: <${gen_msg_id}>
208 References: <${gen_msg_id}>
209
210 On Tue, 05 Jan 2010 15:43:56 -0000, ☃ <snowman@example.com> wrote:
211 > Encoding"
212
213 test_begin_subtest "Reply with RFC 2047-encoded headers (JSON)"
214 output=$(notmuch reply --format=json id:${gen_msg_id})
215 test_expect_equal_json "$output" '
216 {
217     "original": {
218         "body": [
219             {
220                 "content": "Encoding\n",
221                 "content-type": "text/plain",
222                 "id": 1
223             }
224         ],
225         "date_relative": "2010-01-05",
226         "excluded": false,
227         "filename": "'${MAIL_DIR}'/msg-012",
228         "headers": {
229             "Date": "Tue, 05 Jan 2010 15:43:56 +0000",
230             "From": "\u2603 <snowman@example.com>",
231             "Subject": "\u00e0\u00df\u00e7",
232             "To": "Notmuch Test Suite <test_suite@notmuchmail.org>"
233         },
234         "id": "'${gen_msg_id}'",
235         "match": false,
236         "tags": [
237             "inbox",
238             "unread"
239         ],
240         "timestamp": 1262706236
241     },
242     "reply-headers": {
243         "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
244         "In-reply-to": "<'${gen_msg_id}'>",
245         "References": "<'${gen_msg_id}'>",
246         "Subject": "Re: \u00e0\u00df\u00e7",
247         "To": "\u2603 <snowman@example.com>"
248     }
249 }'
250
251
252 test_done