From 0c53cdd869613f063b4f647b3f8de194a3417b60 Mon Sep 17 00:00:00 2001 From: Alexandre Pretto Nunes Date: Tue, 2 Dec 2014 10:32:33 -0200 Subject: #135 Use reply-to field instead of from when present --- service/test/unit/adapter/mail_test.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'service/test') diff --git a/service/test/unit/adapter/mail_test.py b/service/test/unit/adapter/mail_test.py index 4cc29287..f436bb6c 100644 --- a/service/test/unit/adapter/mail_test.py +++ b/service/test/unit/adapter/mail_test.py @@ -103,6 +103,25 @@ 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' + + InputMail.FROM_EMAIL_ADDRESS = 'me@pixelated.org' + + mail = PixelatedMail.from_soledad(fdoc, hdoc, bdoc, soledad_querier=self.querier) + + _dict = mail.as_dict() + + self.assertEquals(_dict['replying'], {'single': 'reply-to-this-address@pixelated.org', + 'all': { + 'to-field': ['alice@pixelated.org', 'reply-to-this-address@pixelated.org'], + 'cc-field': [] + }}) + def test_alternatives_body(self): parts = {'alternatives': [], 'attachments': []} parts['alternatives'].append({'content': 'blablabla', 'headers': {'Content-Type': 'text/plain'}}) -- cgit v1.2.3