diff options
author | Patrick Maia and Victor Shyba <pixelated-team+pmaia+vshyba@thoughtworks.com> | 2014-11-21 19:07:27 -0300 |
---|---|---|
committer | Patrick Maia <pmaia@thoughtworks.com> | 2014-11-21 19:07:27 -0300 |
commit | 5c39786d9166d4882e787d6b80d7086c5c34e395 (patch) | |
tree | 6c114ca223c03c010e75ed46a0653c0a68951e67 /service/test | |
parent | 5f39512edef09f1a6c88e73c170880761b096ba6 (diff) |
for #14, properly split and strip addresses
Diffstat (limited to 'service/test')
-rw-r--r-- | service/test/unit/adapter/mail_test.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/service/test/unit/adapter/mail_test.py b/service/test/unit/adapter/mail_test.py index d0e2bcec..eaa6efb4 100644 --- a/service/test/unit/adapter/mail_test.py +++ b/service/test/unit/adapter/mail_test.py @@ -112,6 +112,20 @@ 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 <one@mail.com>,\nTwo <two@mail.com>, Normal <normal@mail.com>,\nalone@mail.com' + hdoc.content['headers']['Bcc'] = hdoc.content['headers']['To'] + hdoc.content['headers']['Cc'] = hdoc.content['headers']['To'] + + mail = PixelatedMail.from_soledad(fdoc, hdoc, bdoc, soledad_querier=self.querier) + + for header_label in ['To', 'Cc', 'Bcc']: + for address in mail.headers[header_label]: + self.assertNotIn('\n', address) + self.assertNotIn(',', address) + self.assertEquals(4, len(mail.headers[header_label])) + class InputMailTest(unittest.TestCase): mail_dict = lambda x: { |