diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-08-27 15:05:22 -0300 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-08-28 16:34:20 -0300 |
commit | 5207cd71baabc3203d3f7982d98168469139327d (patch) | |
tree | ef2ce92656f350b005742976e37230d950b60d6a /service/test | |
parent | c51c1024299fcf69cc67388b7dc35760a0414d12 (diff) |
Duda/Neissi adding to_mime_multipart method to pixelated mail
Diffstat (limited to 'service/test')
-rw-r--r-- | service/test/adapter/pixelated_mail_test.py | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/service/test/adapter/pixelated_mail_test.py b/service/test/adapter/pixelated_mail_test.py index 81e9f340..b6bf623f 100644 --- a/service/test/adapter/pixelated_mail_test.py +++ b/service/test/adapter/pixelated_mail_test.py @@ -21,6 +21,17 @@ import test_helper class TestPixelatedMail(unittest.TestCase): + mail_dict = { + 'body': 'Este \xe9 o corpo', + 'header': { + 'cc': ['cc@pixelated.org'], + 'to': ['to@pixelated.org'], + 'subject': 'Oi', + 'bcc': ['bcc@pixelated.org'] + }, + 'ident': '', + 'tags': ['sent'] + } def test_leap_recent_flag_is_translated_to_inbox_tag(self): pixelated_mail = PixelatedMail.from_leap_mail(test_helper.leap_mail(leap_flags=['\\Recent'])) @@ -48,23 +59,12 @@ class TestPixelatedMail(unittest.TestCase): self.assertEquals(set([Tag('custom_tag'), Tag('inbox')]), pixelated_mail.tags) def test_from_dict(self): - mail_dict = { - 'body': 'Este \xe9 o corpo', - 'header': { - 'cc': ['cc@pixelated.com'], - 'to': ['to@pixelated.com'], - 'subject': 'Oi', - 'bcc': ['bcc@pixelated.com'] - }, - 'ident': '', - 'tags': ['sent'] - } - - mail = PixelatedMail.from_dict(mail_dict) - - self.assertEqual(mail.headers['cc'], ['cc@pixelated.com']) - self.assertEqual(mail.headers['to'], ['to@pixelated.com']) - self.assertEqual(mail.headers['bcc'], ['bcc@pixelated.com']) + + mail = PixelatedMail.from_dict(self.mail_dict) + + self.assertEqual(mail.headers['cc'], ['cc@pixelated.org']) + self.assertEqual(mail.headers['to'], ['to@pixelated.org']) + self.assertEqual(mail.headers['bcc'], ['bcc@pixelated.org']) self.assertEqual(mail.headers['subject'], 'Oi') self.assertEqual(mail.ident, '') self.assertEqual(mail.tags, ['sent']) @@ -75,3 +75,13 @@ class TestPixelatedMail(unittest.TestCase): current_tags, removed_tags = pixelated_mail.update_tags(set([Tag('custom_1'), Tag('custom_3')])) self.assertEquals(set([Tag('custom_3'), Tag('custom_1')]), current_tags) self.assertEquals(set([Tag('custom_2')]), removed_tags) + + def test_to_mime_multipart(self): + mail = PixelatedMail.from_dict(self.mail_dict) + + mime_multipart = mail.to_mime_multipart() + + self.assertRegexpMatches(mime_multipart.as_string(), "\nTo: to@pixelated.org\n") + self.assertRegexpMatches(mime_multipart.as_string(), "\nSubject: Oi\n") + self.assertRegexpMatches(mime_multipart.as_string(), "\nEste \xe9 o corpo") + |