From d0abd13f5d1f512aeae550cc0214db014cfdc52c Mon Sep 17 00:00:00 2001 From: Patrick Maia and Victor Shyba Date: Fri, 24 Oct 2014 18:10:31 -0300 Subject: Card #30 - considers all parts when generating mail body --- service/test/unit/adapter/mail_test.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'service/test/unit/adapter') diff --git a/service/test/unit/adapter/mail_test.py b/service/test/unit/adapter/mail_test.py index 3bec6fc7..35fe411e 100644 --- a/service/test/unit/adapter/mail_test.py +++ b/service/test/unit/adapter/mail_test.py @@ -90,6 +90,18 @@ class TestPixelatedMail(unittest.TestCase): 'tags': [] }) + def test_alternatives_body(self): + parts = {'alternatives': [], 'attachments': []} + parts['alternatives'].append({'content': 'blablabla', 'headers': {'Content-Type': 'text/plain'}}) + parts['alternatives'].append({'content': '

blablabla

', 'headers': {'Content-Type': 'text/html'}}) + + mail = PixelatedMail.from_soledad(None, None, None, None, parts=parts) + + self.assertRegexpMatches(mail.body, '^--' + mail.boundary + '\n.*') + self.assertRegexpMatches(mail.body, '\nContent-Type: text/html\n\n

blablabla

\n') + self.assertRegexpMatches(mail.body, '\nContent-Type: text/plain\n\nblablabla\n') + self.assertRegexpMatches(mail.body, '.*--' + mail.boundary + '--$') + class InputMailTest(unittest.TestCase): mail_dict = lambda x: { -- cgit v1.2.3