unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob d6f3a839ca48fe55ec81471ef72c872cd11ef9ee 10645 bytes (raw)
name: test/T220-reply.sh 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
 
#!/usr/bin/env bash
test_description="\"notmuch reply\" in several variations"
. ./test-lib.sh || exit 1

test_begin_subtest "Basic reply"
add_message '[from]="Sender <sender@example.com>"' \
	     [to]=test_suite@notmuchmail.org \
	     [subject]=notmuch-reply-test \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="basic reply test"'

output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
Subject: Re: notmuch-reply-test
To: Sender <sender@example.com>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> basic reply test"

test_begin_subtest "Multiple recipients"
add_message '[from]="Sender <sender@example.com>"' \
	    '[to]="test_suite@notmuchmail.org, Someone Else <someone@example.com>"' \
	     [subject]=notmuch-reply-test \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="Multiple recipients"'

output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
Subject: Re: notmuch-reply-test
To: Sender <sender@example.com>, Someone Else <someone@example.com>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> Multiple recipients"

test_begin_subtest "Reply with CC"
add_message '[from]="Sender <sender@example.com>"' \
	     [to]=test_suite@notmuchmail.org \
	    '[cc]="Other Parties <cc@example.com>"' \
	     [subject]=notmuch-reply-test \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="reply with CC"'

output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
Subject: Re: notmuch-reply-test
To: Sender <sender@example.com>
Cc: Other Parties <cc@example.com>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> reply with CC"

test_begin_subtest "Reply from alternate address"
add_message '[from]="Sender <sender@example.com>"' \
	     [to]=test_suite_other@notmuchmail.org \
	     [subject]=notmuch-reply-test \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="reply from alternate address"'

output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
Subject: Re: notmuch-reply-test
To: Sender <sender@example.com>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> reply from alternate address"

test_begin_subtest "Reply from address in named group list"
add_message '[from]="Sender <sender@example.com>"' \
            '[to]=group:test_suite@notmuchmail.org,someone@example.com\;' \
             [cc]=test_suite_other@notmuchmail.org \
             [subject]=notmuch-reply-test \
            '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
            '[body]="Reply from address in named group list"'

output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
Subject: Re: notmuch-reply-test
To: Sender <sender@example.com>, someone@example.com
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> Reply from address in named group list"

test_begin_subtest "Support for Reply-To"
add_message '[from]="Sender <sender@example.com>"' \
	     [to]=test_suite@notmuchmail.org \
	     [subject]=notmuch-reply-test \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="support for reply-to"' \
	    '[reply-to]="Sender <elsewhere@example.com>"'

output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
Subject: Re: notmuch-reply-test
To: Sender <elsewhere@example.com>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> support for reply-to"

test_begin_subtest "Un-munging Reply-To"
add_message '[from]="Sender <sender@example.com>"' \
	    '[to]="Some List <list@example.com>"' \
	     [subject]=notmuch-reply-test \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="Un-munging Reply-To"' \
	    '[reply-to]="Evil Munging List <list@example.com>"'

output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
Subject: Re: notmuch-reply-test
To: Sender <sender@example.com>, Some List <list@example.com>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> Un-munging Reply-To"

test_begin_subtest "Message with header of exactly 200 bytes"
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"' \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="200-byte header"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
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
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
> 200-byte header"

test_begin_subtest "From guessing: Envelope-To"
add_message '[from]="Sender <sender@example.com>"' \
	    '[to]="Recipient <recipient@example.com>"' \
	    '[subject]="From guessing"' \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="From guessing"' \
	    '[header]="Envelope-To: test_suite_other@notmuchmail.org"'

output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
Subject: Re: From guessing
To: Sender <sender@example.com>, Recipient <recipient@example.com>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> From guessing"

test_begin_subtest "From guessing: X-Original-To"
add_message '[from]="Sender <sender@example.com>"' \
	    '[to]="Recipient <recipient@example.com>"' \
	    '[subject]="From guessing"' \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="From guessing"' \
	    '[header]="X-Original-To: test_suite@otherdomain.org"'

output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@otherdomain.org>
Subject: Re: From guessing
To: Sender <sender@example.com>, Recipient <recipient@example.com>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> From guessing"

test_begin_subtest "From guessing: Delivered-To"
add_message '[from]="Sender <sender@example.com>"' \
	    '[to]="Recipient <recipient@example.com>"' \
	    '[subject]="From guessing"' \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="From guessing"' \
	    '[header]="Delivered-To: test_suite_other@notmuchmail.org"'

output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
Subject: Re: From guessing
To: Sender <sender@example.com>, Recipient <recipient@example.com>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> From guessing"

test_begin_subtest "Reply with RFC 2047-encoded headers"
add_message '[subject]="=?iso-8859-1?q?=e0=df=e7?="' \
	    '[from]="=?utf-8?q?=e2=98=83?= <snowman@example.com>"' \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="Encoding"'

# GMime happens to change from Q- to B-encoding.  We canonicalize the
# case of the encoding and charset because different versions of GMime
# capitalize the encoding differently.
output=$(notmuch reply id:${gen_msg_id} | perl -pe 's/=\?[^?]+\?[bB]\?/lc($&)/ge')
test_expect_equal "$output" "\
From: Notmuch Test Suite <test_suite@notmuchmail.org>
Subject: Re: =?iso-8859-1?b?4N/n?=
To: =?utf-8?b?4piD?= <snowman@example.com>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, ☃ <snowman@example.com> wrote:
> Encoding"

test_begin_subtest "Reply with RFC 2047-encoded headers (JSON)"
output=$(notmuch reply --format=json id:${gen_msg_id})
test_expect_equal_json "$output" '
{
    "original": {
        "body": [
            {
                "content": "Encoding\n",
                "content-type": "text/plain",
                "id": 1
            }
        ],
        "date_relative": "2010-01-05",
        "excluded": false,
        "filename": "'${MAIL_DIR}'/msg-012",
        "headers": {
            "Date": "Tue, 05 Jan 2010 15:43:56 +0000",
            "From": "\u2603 <snowman@example.com>",
            "Subject": "\u00e0\u00df\u00e7",
            "To": "Notmuch Test Suite <test_suite@notmuchmail.org>"
        },
        "id": "'${gen_msg_id}'",
        "match": false,
        "tags": [
            "inbox",
            "unread"
        ],
        "timestamp": 1262706236
    },
    "reply-headers": {
        "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
        "In-reply-to": "<'${gen_msg_id}'>",
        "References": "<'${gen_msg_id}'>",
        "Subject": "Re: \u00e0\u00df\u00e7",
        "To": "\u2603 <snowman@example.com>"
    }
}'

test_begin_subtest "Reply to a message with multiple Cc headers"
test_subtest_known_broken
cat > "${MAIL_DIR}"/broken_cc <<EOF
From: Alice <alice@example.org>
To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Cc: Bob <bob@example.org>
Subject: wowsers!
cc: Charles <charles@example.org>
Message-Id: <abc123@example.org>
Date: Thu, 16 Jun 2016 22:14:41 -0400

Note the Cc: and cc: headers.
EOF
notmuch new >/dev/null
output=$(notmuch reply id:abc123@example.org)
notmuch reply id:abc123@example.com
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
Subject: Re: wowsers!
To: Alice <alice@example.org>, Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Cc: Bob <bob@example.org>, Charles <charles@example.org>
In-Reply-To: <abc123@example.org>
References: <abc123@example.org>

On Thu, 16 Jun 2016 22:14:41 -0400, Alice <alice@example.org> wrote:
> Note the Cc: and cc: headers."

test_done

debug log:

solving d6f3a839ca48 ...
found d6f3a839ca48 in https://yhetil.org/notmuch/8c280fe978c12eccb662b0ebc97d9d3c794f6688.1471088022.git.jani@nikula.org/
found 30b78f679d97 in https://yhetil.org/notmuch.git/
preparing index
index prepared:
100755 30b78f679d97d82aa42d4817d93c654b5177cf7e	test/T220-reply.sh

applying [1/1] https://yhetil.org/notmuch/8c280fe978c12eccb662b0ebc97d9d3c794f6688.1471088022.git.jani@nikula.org/
diff --git a/test/T220-reply.sh b/test/T220-reply.sh
index 30b78f679d97..d6f3a839ca48 100755

Checking patch test/T220-reply.sh...
Applied patch test/T220-reply.sh cleanly.

index at:
100755 d6f3a839ca48fe55ec81471ef72c872cd11ef9ee	test/T220-reply.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).