@matheusbsbs / matheus-bagliano / commits / 33c592ddd5
Fork 0

Add tests for sendemail.cc configuration variable

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Miklos Vajna committed Apr 29, 2008 at 12:56 UTC 33c592ddd55faa96d0f425710da5742339796b89
1 file changed +66
t/t9001-send-email.sh
+66
@@ -166,4 +166,70 @@ test_expect_success 'second message is patch' '
166 grep "Subject:.*Second" msgtxt2
167 '
168
169 +cat >expected-show-all-headers <<\EOF
170 +0001-Second.patch
171 +(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
172 +Dry-OK. Log says:
173 +Server: relay.example.com
174 +MAIL FROM:<from@example.com>
175 +RCPT TO:<to@example.com>,<cc@example.com>,<author@example.com>
176 +From: Example <from@example.com>
177 +To: to@example.com
178 +Cc: cc@example.com, A <author@example.com>
179 +Subject: [PATCH 1/1] Second.
180 +Date: DATE-STRING
181 +Message-Id: MESSAGE-ID-STRING
182 +X-Mailer: X-MAILER-STRING
183 +
184 +Result: OK
185 +EOF
186 +
187 +test_expect_success 'sendemail.cc set' '
188 + git config sendemail.cc cc@example.com &&
189 + git send-email \
190 + --dry-run \
191 + --from="Example <from@example.com>" \
192 + --to=to@example.com \
193 + --smtp-server relay.example.com \
194 + $patches |
195 + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
196 + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
197 + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
198 + >actual-show-all-headers &&
199 + test_cmp expected-show-all-headers actual-show-all-headers
200 +'
201 +
202 +cat >expected-show-all-headers <<\EOF
203 +0001-Second.patch
204 +(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
205 +Dry-OK. Log says:
206 +Server: relay.example.com
207 +MAIL FROM:<from@example.com>
208 +RCPT TO:<to@example.com>,<author@example.com>
209 +From: Example <from@example.com>
210 +To: to@example.com
211 +Cc: A <author@example.com>
212 +Subject: [PATCH 1/1] Second.
213 +Date: DATE-STRING
214 +Message-Id: MESSAGE-ID-STRING
215 +X-Mailer: X-MAILER-STRING
216 +
217 +Result: OK
218 +EOF
219 +
220 +test_expect_success 'sendemail.cc unset' '
221 + git config --unset sendemail.cc &&
222 + git send-email \
223 + --dry-run \
224 + --from="Example <from@example.com>" \
225 + --to=to@example.com \
226 + --smtp-server relay.example.com \
227 + $patches |
228 + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
229 + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
230 + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
231 + >actual-show-all-headers &&
232 + test_cmp expected-show-all-headers actual-show-all-headers
233 +'
234 +
235 test_done