summaryrefslogtreecommitdiff
path: root/service/test/unit/adapter/test_mail.py
diff options
context:
space:
mode:
authorJefferson Stachelski <jstachel@thoughtworks.com>2015-03-19 11:06:48 -0300
committerJefferson Stachelski <jstachel@thoughtworks.com>2015-03-19 11:06:48 -0300
commite500877b7de0fa1f249887e7afe089f560094893 (patch)
tree43c26de69f427f578cd2aaf86c1a2152318ee442 /service/test/unit/adapter/test_mail.py
parentd732de6df06ed8e18647e19b13534da11fdc7ff5 (diff)
#248 Wrote missing tests
Diffstat (limited to 'service/test/unit/adapter/test_mail.py')
-rw-r--r--service/test/unit/adapter/test_mail.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/service/test/unit/adapter/test_mail.py b/service/test/unit/adapter/test_mail.py
index 87fbecc1..fc0861d6 100644
--- a/service/test/unit/adapter/test_mail.py
+++ b/service/test/unit/adapter/test_mail.py
@@ -303,6 +303,26 @@ class TestPixelatedMail(unittest.TestCase):
self.content = {'raw': raw}
return FakeBDoc(raw)
+ 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>?="
+
+ 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>')
+
+ 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>?="
+
+ leap_mail = test_helper.leap_mail(extra_headers={'Subject': subject, 'From': email_from})
+
+ 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>')
+
class InputMailTest(unittest.TestCase):
mail_dict = lambda x: {