196535aeacd2d7af546cdf9a5f2bcb6b0b9c84af
[notmuch] / 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 test_subtest_known_broken
77 add_message '[from]="Sender <sender@example.com>"' \
78             '[to]=group:test_suite@notmuchmail.org,someone@example.com\;' \
79              [cc]=test_suite_other@notmuchmail.org \
80              [subject]=notmuch-reply-test \
81             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
82             '[body]="Reply from address in named group list"'
83
84 output=$(notmuch reply id:${gen_msg_id})
85 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
86 Subject: Re: notmuch-reply-test
87 To: Sender <sender@example.com>, someone@example.com
88 In-Reply-To: <${gen_msg_id}>
89 References: <${gen_msg_id}>
90
91 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
92 > Reply from address in named group list"
93
94 test_begin_subtest "Support for Reply-To"
95 add_message '[from]="Sender <sender@example.com>"' \
96              [to]=test_suite@notmuchmail.org \
97              [subject]=notmuch-reply-test \
98             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
99             '[body]="support for reply-to"' \
100             '[reply-to]="Sender <elsewhere@example.com>"'
101
102 output=$(notmuch reply id:${gen_msg_id})
103 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
104 Subject: Re: notmuch-reply-test
105 To: Sender <elsewhere@example.com>
106 In-Reply-To: <${gen_msg_id}>
107 References: <${gen_msg_id}>
108
109 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
110 > support for reply-to"
111
112 test_begin_subtest "Un-munging Reply-To"
113 add_message '[from]="Sender <sender@example.com>"' \
114             '[to]="Some List <list@example.com>"' \
115              [subject]=notmuch-reply-test \
116             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
117             '[body]="Un-munging Reply-To"' \
118             '[reply-to]="Evil Munging List <list@example.com>"'
119
120 output=$(notmuch reply id:${gen_msg_id})
121 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
122 Subject: Re: notmuch-reply-test
123 To: Sender <sender@example.com>, Some List <list@example.com>
124 In-Reply-To: <${gen_msg_id}>
125 References: <${gen_msg_id}>
126
127 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
128 > Un-munging Reply-To"
129
130 test_begin_subtest "Message with header of exactly 200 bytes"
131 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"' \
132             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
133             '[body]="200-byte header"'
134 output=$(notmuch reply id:${gen_msg_id})
135 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
136 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
137 In-Reply-To: <${gen_msg_id}>
138 References: <${gen_msg_id}>
139
140 On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
141 > 200-byte header"
142 test_done