summaryrefslogtreecommitdiff
path: root/service/test
diff options
context:
space:
mode:
authorLisa Junger <ljunger@thoughtworks.com>2015-01-06 11:25:10 +0100
committerLisa Junger <ljunger@thoughtworks.com>2015-01-06 11:47:16 +0100
commitbd903ece01d9a1f85f3459f6495ad342bb64500e (patch)
tree978219d5b1668fc83d3346afae9d0cdea60e2526 /service/test
parente36e4e95b80b8ac2265136f12d16510877db4282 (diff)
Issue #215: Fixed missing From header for sent mails.
- Fixes problem with trailing comma for reply all
Diffstat (limited to 'service/test')
-rw-r--r--service/test/support/test_helper.py5
-rw-r--r--service/test/unit/adapter/mail_test.py13
2 files changed, 17 insertions, 1 deletions
diff --git a/service/test/support/test_helper.py b/service/test/support/test_helper.py
index b2d3cf43..ff1de64a 100644
--- a/service/test/support/test_helper.py
+++ b/service/test/support/test_helper.py
@@ -43,10 +43,13 @@ def mail_dict():
}
-class TestDoc:
+class TestDoc(object):
def __init__(self, content):
self.content = content
+ def __getitem__(self, key):
+ return self.content[key]
+
def leap_mail(uid=0, flags=LEAP_FLAGS, headers=None, extra_headers={}, mbox='INBOX', body='body',
chash='chash'):
diff --git a/service/test/unit/adapter/mail_test.py b/service/test/unit/adapter/mail_test.py
index e8fd8755..e0b7a498 100644
--- a/service/test/unit/adapter/mail_test.py
+++ b/service/test/unit/adapter/mail_test.py
@@ -21,6 +21,8 @@ from mockito import *
from test.support import test_helper
import dateutil.parser as dateparser
import base64
+from leap.mail.imap.fields import fields
+from datetime import datetime
class TestPixelatedMail(unittest.TestCase):
@@ -69,6 +71,17 @@ class TestPixelatedMail(unittest.TestCase):
self.assertEquals(mail.fdoc.content['flags'], [])
+ def test_get_for_save_adds_from(self):
+ InputMail.FROM_EMAIL_ADDRESS = 'me@pixelated.org'
+ headers = {'Subject': 'The subject',
+ 'Date': str(datetime.now()),
+ 'To': 'me@pixelated.org'}
+
+ input_mail = InputMail()
+ input_mail.headers = headers
+
+ self.assertEqual('me@pixelated.org', input_mail.get_for_save(1, 'SENT')[1][fields.HEADERS_KEY]['From'])
+
def test_as_dict(self):
headers = {'Subject': 'The subject',
'From': 'someone@pixelated.org',