diff options
| author | Jefferson Stachelski <jstachel@thoughtworks.com> | 2015-03-19 11:06:48 -0300 | 
|---|---|---|
| committer | Jefferson Stachelski <jstachel@thoughtworks.com> | 2015-03-19 11:06:48 -0300 | 
| commit | e500877b7de0fa1f249887e7afe089f560094893 (patch) | |
| tree | 43c26de69f427f578cd2aaf86c1a2152318ee442 /service/test/unit/adapter/test_mail.py | |
| parent | d732de6df06ed8e18647e19b13534da11fdc7ff5 (diff) | |
#248 Wrote missing tests
Diffstat (limited to 'service/test/unit/adapter/test_mail.py')
| -rw-r--r-- | service/test/unit/adapter/test_mail.py | 20 | 
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: { | 
