From bd8fd4d18c1f43d2a393cb5cf7aea6abb523fd9a Mon Sep 17 00:00:00 2001 From: Alexandre Pretto Nunes Date: Wed, 3 Dec 2014 15:43:25 -0200 Subject: #135 fix python unit tests --- service/test/unit/adapter/mail_test.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'service/test/unit/adapter/mail_test.py') diff --git a/service/test/unit/adapter/mail_test.py b/service/test/unit/adapter/mail_test.py index f436bb6c..332fad8a 100644 --- a/service/test/unit/adapter/mail_test.py +++ b/service/test/unit/adapter/mail_test.py @@ -69,10 +69,11 @@ class TestPixelatedMail(unittest.TestCase): self.assertEquals(mail.fdoc.content['flags'], []) def test_as_dict(self): - fdoc, hdoc, bdoc = test_helper.leap_mail(flags=['\\Recent']) - hdoc.content['headers']['Subject'] = 'The subject' - hdoc.content['headers']['From'] = 'someone@pixelated.org' - hdoc.content['headers']['To'] = 'me@pixelated.org' + headers = {'Subject': 'The subject', + 'From': 'someone@pixelated.org', + 'To': 'me@pixelated.org'} + fdoc, hdoc, bdoc = test_helper.leap_mail(flags=['\\Recent'], + extra_headers=headers) InputMail.FROM_EMAIL_ADDRESS = 'me@pixelated.org' @@ -104,11 +105,12 @@ class TestPixelatedMail(unittest.TestCase): }}) def test_use_reply_to_address_for_replying(self): - fdoc, hdoc, bdoc = test_helper.leap_mail(flags=['\\Recent']) - hdoc.content['headers']['Subject'] = 'The subject' - hdoc.content['headers']['From'] = 'someone@pixelated.org' - hdoc.content['headers']['Reply-To'] = 'reply-to-this-address@pixelated.org' - hdoc.content['headers']['To'] = 'me@pixelated.org, \nalice@pixelated.org' + headers = {'Subject': 'The subject', + 'From': 'someone@pixelated.org', + 'Reply-To': 'reply-to-this-address@pixelated.org', + 'To': 'me@pixelated.org, \nalice@pixelated.org'} + fdoc, hdoc, bdoc = test_helper.leap_mail(flags=['\\Recent'], + extra_headers=headers) InputMail.FROM_EMAIL_ADDRESS = 'me@pixelated.org' @@ -144,10 +146,12 @@ class TestPixelatedMail(unittest.TestCase): self.assertRegexpMatches(mail.body, '([\s\S]*100%){2}') def test_clean_line_breaks_on_address_headers(self): - fdoc, hdoc, bdoc = test_helper.leap_mail(flags=['\\Recent']) - hdoc.content['headers']['To'] = 'One ,\nTwo , Normal ,\nalone@mail.com' - hdoc.content['headers']['Bcc'] = hdoc.content['headers']['To'] - hdoc.content['headers']['Cc'] = hdoc.content['headers']['To'] + many_recipients = 'One ,\nTwo , Normal ,\nalone@mail.com' + headers = {'Cc': many_recipients, + 'Bcc': many_recipients, + 'To': many_recipients} + fdoc, hdoc, bdoc = test_helper.leap_mail(flags=['\\Recent'], + extra_headers=headers) mail = PixelatedMail.from_soledad(fdoc, hdoc, bdoc, soledad_querier=self.querier) -- cgit v1.2.3