test: renamed test scripts to format T\d\d\d-name.sh
[notmuch] / test / T230-reply-to-sender.sh
1 #!/usr/bin/env bash
2 test_description="\"notmuch reply --reply-to=sender\" in several variations"
3 . ./test-lib.sh
4
5 test_begin_subtest "Basic reply-to-sender"
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-to-sender test"'
11
12 output=$(notmuch reply --reply-to=sender 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-to-sender test"
21
22 test_begin_subtest "From Us, Basic reply to message"
23 add_message '[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"' \
24             '[to]="Recipient <recipient@example.com>"' \
25              [subject]=notmuch-reply-test \
26             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
27             '[body]="basic reply-to-from-us test"'
28
29 output=$(notmuch reply --reply-to=sender 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: Recipient <recipient@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, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
37 > basic reply-to-from-us test"
38
39 test_begin_subtest "Multiple recipients"
40 add_message '[from]="Sender <sender@example.com>"' \
41             '[to]="test_suite@notmuchmail.org, Someone Else <someone@example.com>"' \
42              [subject]=notmuch-reply-test \
43             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
44             '[body]="Multiple recipients"'
45
46 output=$(notmuch reply  --reply-to=sender  id:${gen_msg_id})
47 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
48 Subject: Re: notmuch-reply-test
49 To: Sender <sender@example.com>
50 In-Reply-To: <${gen_msg_id}>
51 References: <${gen_msg_id}>
52
53 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
54 > Multiple recipients"
55
56 test_begin_subtest "From Us, Multiple TO recipients"
57 add_message '[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"' \
58             '[to]="Recipient <recipient@example.com>, Someone Else <someone@example.com>"' \
59              [subject]=notmuch-reply-test \
60             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
61             '[body]="From Us, Multiple TO recipients"'
62
63 output=$(notmuch reply  --reply-to=sender  id:${gen_msg_id})
64 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
65 Subject: Re: notmuch-reply-test
66 To: Recipient <recipient@example.com>, Someone Else <someone@example.com>
67 In-Reply-To: <${gen_msg_id}>
68 References: <${gen_msg_id}>
69
70 On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
71 > From Us, Multiple TO recipients"
72
73 test_begin_subtest "Reply with CC"
74 add_message '[from]="Sender <sender@example.com>"' \
75              [to]=test_suite@notmuchmail.org \
76             '[cc]="Other Parties <cc@example.com>"' \
77              [subject]=notmuch-reply-test \
78             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
79             '[body]="reply with CC"'
80
81 output=$(notmuch reply  --reply-to=sender id:${gen_msg_id})
82 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
83 Subject: Re: notmuch-reply-test
84 To: Sender <sender@example.com>
85 In-Reply-To: <${gen_msg_id}>
86 References: <${gen_msg_id}>
87
88 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
89 > reply with CC"
90
91 test_begin_subtest "From Us, Reply with CC"
92 add_message '[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"' \
93             '[to]="Recipient <recipient@example.com>"' \
94             '[cc]="Other Parties <cc@example.com>"' \
95              [subject]=notmuch-reply-test \
96             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
97             '[body]="reply with CC"'
98
99 output=$(notmuch reply  --reply-to=sender id:${gen_msg_id})
100 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
101 Subject: Re: notmuch-reply-test
102 To: Recipient <recipient@example.com>
103 In-Reply-To: <${gen_msg_id}>
104 References: <${gen_msg_id}>
105
106 On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
107 > reply with CC"
108
109 test_begin_subtest "From Us, Reply no TO but with CC"
110 add_message '[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"' \
111             '[cc]="Other Parties <cc@example.com>"' \
112              [subject]=notmuch-reply-test \
113             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
114             '[body]="reply with CC"'
115
116 output=$(notmuch reply  --reply-to=sender id:${gen_msg_id})
117 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
118 Subject: Re: notmuch-reply-test
119 Cc: Other Parties <cc@example.com>
120 In-Reply-To: <${gen_msg_id}>
121 References: <${gen_msg_id}>
122
123 On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
124 > reply with CC"
125
126 test_begin_subtest "Reply from alternate address"
127 add_message '[from]="Sender <sender@example.com>"' \
128              [to]=test_suite_other@notmuchmail.org \
129              [subject]=notmuch-reply-test \
130             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
131             '[body]="reply from alternate address"'
132
133 output=$(notmuch reply  --reply-to=sender id:${gen_msg_id})
134 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
135 Subject: Re: notmuch-reply-test
136 To: Sender <sender@example.com>
137 In-Reply-To: <${gen_msg_id}>
138 References: <${gen_msg_id}>
139
140 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
141 > reply from alternate address"
142
143 test_begin_subtest "Support for Reply-To"
144 add_message '[from]="Sender <sender@example.com>"' \
145              [to]=test_suite@notmuchmail.org \
146              [subject]=notmuch-reply-test \
147             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
148             '[body]="support for reply-to"' \
149             '[reply-to]="Sender <elsewhere@example.com>"'
150
151 output=$(notmuch reply  --reply-to=sender id:${gen_msg_id})
152 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
153 Subject: Re: notmuch-reply-test
154 To: Sender <elsewhere@example.com>
155 In-Reply-To: <${gen_msg_id}>
156 References: <${gen_msg_id}>
157
158 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
159 > support for reply-to"
160
161 test_begin_subtest "Support for Reply-To with multiple recipients"
162 add_message '[from]="Sender <sender@example.com>"' \
163             '[to]="test_suite@notmuchmail.org, Someone Else <someone@example.com>"' \
164              [subject]=notmuch-reply-test \
165             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
166             '[body]="support for reply-to with multiple recipients"' \
167             '[reply-to]="Sender <elsewhere@example.com>"'
168
169 output=$(notmuch reply  --reply-to=sender id:${gen_msg_id})
170 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
171 Subject: Re: notmuch-reply-test
172 To: Sender <elsewhere@example.com>
173 In-Reply-To: <${gen_msg_id}>
174 References: <${gen_msg_id}>
175
176 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
177 > support for reply-to with multiple recipients"
178
179 test_begin_subtest "Un-munging Reply-To"
180 add_message '[from]="Sender <sender@example.com>"' \
181             '[to]="Some List <list@example.com>"' \
182              [subject]=notmuch-reply-test \
183             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
184             '[body]="Un-munging Reply-To"' \
185             '[reply-to]="Evil Munging List <list@example.com>"'
186
187 output=$(notmuch reply  --reply-to=sender id:${gen_msg_id})
188 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
189 Subject: Re: notmuch-reply-test
190 To: Sender <sender@example.com>
191 In-Reply-To: <${gen_msg_id}>
192 References: <${gen_msg_id}>
193
194 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
195 > Un-munging Reply-To"
196
197 test_begin_subtest "Message with header of exactly 200 bytes"
198 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"' \
199             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
200             '[body]="200-byte header"'
201 output=$(notmuch reply  --reply-to=sender id:${gen_msg_id})
202 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
203 Subject: Re: This subject is exactly 200 bytes in length. Other than its
204  length there is not much of note here. Note that the length of 200 bytes
205  includes the Subject: and Re: prefixes with two spaces
206 In-Reply-To: <${gen_msg_id}>
207 References: <${gen_msg_id}>
208
209 On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
210 > 200-byte header"
211 test_done