diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-03-20 13:45:29 +0100 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-03-20 13:45:29 +0100 |
commit | d43abfceecee6051f6c29c48e64a073455356cb5 (patch) | |
tree | c507ca77756772542dc5b8c1ea8b4ed142753c08 /service/test/unit/adapter/test_mail.py | |
parent | e500877b7de0fa1f249887e7afe089f560094893 (diff) |
Added support for encoded To, Cc and Bcc headers.
- Issue #248
Diffstat (limited to 'service/test/unit/adapter/test_mail.py')
-rw-r--r-- | service/test/unit/adapter/test_mail.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/service/test/unit/adapter/test_mail.py b/service/test/unit/adapter/test_mail.py index fc0861d6..1b83f79e 100644 --- a/service/test/unit/adapter/test_mail.py +++ b/service/test/unit/adapter/test_mail.py @@ -306,22 +306,33 @@ class TestPixelatedMail(unittest.TestCase): def test_encoding_special_character_on_header(self): subject = "=?UTF-8?Q?test_encoding_St=C3=A4ch?=" email_from = "=?UTF-8?Q?St=C3=A4ch_<stach@pixelated-project.org>?=" + email_to = "=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=" pixel_mail = PixelatedMail() self.assertEqual(pixel_mail._decode_header(subject), 'test encoding St\xc3\xa4ch') self.assertEqual(pixel_mail._decode_header(email_from), 'St\xc3\xa4ch <stach@pixelated-project.org>') + self.assertEqual(pixel_mail._decode_header(email_to), '"\xc3\x84\xc3\xbc\xc3\xb6 \xc3\x96\xc3\xbc\xc3\xa4" <folker@pixelated-project.org>, F\xc3\xb6lker <folker@pixelated-project.org>') + self.assertEqual(pixel_mail._decode_header(None), None) def test_headers_are_encoded_right(self): subject = "=?UTF-8?Q?test_encoding_St=C3=A4ch?=" email_from = "=?UTF-8?Q?St=C3=A4ch_<stach@pixelated-project.org>?=" + email_to = "=?utf-8?b?IsOEw7zDtiDDlsO8w6QiIDxmb2xrZXJAcGl4ZWxhdGVkLXByb2plY3Qub3Jn?=\n =?utf-8?b?PiwgRsO2bGtlciA8Zm9sa2VyQHBpeGVsYXRlZC1wcm9qZWN0Lm9yZz4=?=" + email_cc = "=?UTF-8?Q?St=C3=A4ch_<stach@pixelated-project.org>?=" + email_bcc = "=?UTF-8?Q?St=C3=A4ch_<stach@pixelated-project.org>?=" - leap_mail = test_helper.leap_mail(extra_headers={'Subject': subject, 'From': email_from}) + leap_mail = test_helper.leap_mail(extra_headers={'Subject': subject, 'From': email_from, 'To': email_to, 'Cc': email_cc, 'Bcc': email_bcc}) mail = PixelatedMail.from_soledad(*leap_mail, soledad_querier=self.querier) self.assertEqual(str(mail.headers['Subject']), 'test encoding St\xc3\xa4ch') self.assertEqual(str(mail.headers['From']), 'St\xc3\xa4ch <stach@pixelated-project.org>') + self.assertEqual(mail.headers['To'], ['"\xc3\x84\xc3\xbc\xc3\xb6 \xc3\x96\xc3\xbc\xc3\xa4" <folker@pixelated-project.org>', 'F\xc3\xb6lker <folker@pixelated-project.org>']) + self.assertEqual(mail.headers['Cc'], ['St\xc3\xa4ch <stach@pixelated-project.org>']) + self.assertEqual(mail.headers['Bcc'], ['St\xc3\xa4ch <stach@pixelated-project.org>']) + + mail.as_dict() class InputMailTest(unittest.TestCase): |