summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeissi Torres Lima <neissi.lima@gmail.com>2014-09-05 11:43:45 -0300
committerNeissi Torres Lima <neissi.lima@gmail.com>2014-09-05 11:50:14 -0300
commite8afeee6c893104048149b9c2f7e79da1fea0cf4 (patch)
tree181a7d2459b97f78c1b516f0f552fceab30de6be
parent08ed4ffd947456a6d1dc789f16c77bedeac11fe6 (diff)
Neissi/Duda - make sure that complex recipients (e.g. 'Foo Bar <foo@bar.com>) are showing properly
-rw-r--r--service/pixelated/adapter/pixelated_mail.py2
-rw-r--r--service/test/adapter/pixelated_mail_test.py13
2 files changed, 8 insertions, 7 deletions
diff --git a/service/pixelated/adapter/pixelated_mail.py b/service/pixelated/adapter/pixelated_mail.py
index 40e4f71f..cd34fe46 100644
--- a/service/pixelated/adapter/pixelated_mail.py
+++ b/service/pixelated/adapter/pixelated_mail.py
@@ -56,7 +56,7 @@ class PixelatedMail:
def _split_recipients(self, header_type, temporary_headers):
if(temporary_headers.get(header_type) is not None):
recipients = temporary_headers[header_type].split(',')
- temporary_headers[header_type] = map(lambda x: x.replace(' ', ''), recipients)
+ temporary_headers[header_type] = map(lambda x: x.lstrip(), recipients)
def _extract_headers(self):
temporary_headers = {}
diff --git a/service/test/adapter/pixelated_mail_test.py b/service/test/adapter/pixelated_mail_test.py
index 66aa3590..7de7c96a 100644
--- a/service/test/adapter/pixelated_mail_test.py
+++ b/service/test/adapter/pixelated_mail_test.py
@@ -90,17 +90,18 @@ class TestPixelatedMail(unittest.TestCase):
def test_extract_headers_should_break_header_in_multiple_recipients(self):
headers = test_helper.DEFAULT_HEADERS.copy()
- headers['to'] = "nlima@example.com, ddornelles@example.com"
- headers['bcc'] = "nlima@example.com, ddornelles@example.com"
- headers['cc'] = "nlima@example.com, ddornelles@example.com"
+
+ headers['to'] = "nlima@example.com, Duda Dornelles <ddornelles@example.com>"
+ headers['bcc'] = "ddornelles@example.com, Neissi Lima <nlima@example.com>"
+ headers['cc'] = "nlima@example.com, Duda Dornelles <ddornelles@example.com>"
leap_mail = test_helper.leap_mail(headers=headers)
pixelated_mail = PixelatedMail.from_leap_mail(leap_mail)
- self.assertEquals(pixelated_mail.headers['to'], ["nlima@example.com", "ddornelles@example.com"])
- self.assertEquals(pixelated_mail.headers['bcc'], ["nlima@example.com", "ddornelles@example.com"])
- self.assertEquals(pixelated_mail.headers['cc'], ["nlima@example.com", "ddornelles@example.com"])
+ self.assertEquals(pixelated_mail.headers['to'], ["nlima@example.com", "Duda Dornelles <ddornelles@example.com>"])
+ self.assertEquals(pixelated_mail.headers['bcc'], ["ddornelles@example.com", "Neissi Lima <nlima@example.com>"])
+ self.assertEquals(pixelated_mail.headers['cc'], ["nlima@example.com", "Duda Dornelles <ddornelles@example.com>"])
def test_mark_as_read(self):
mail = PixelatedMail.from_dict(self.mail_dict)