summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorTulio Casagrande <tcasagra@thoughtworks.com>2016-06-17 14:02:11 -0300
committerTulio Casagrande <tcasagra@thoughtworks.com>2016-06-17 14:02:11 -0300
commit8d0cbb87c86493de19782a3ef40dfb6d7dad2a68 (patch)
treedf45b38c23b235c25c8b02d0cbe7d09b18f0d52c /service
parent61ba137986f5830abedd22d42ec3a3bb28c0abf0 (diff)
Issue #608: Fix lowercase attachment test to check the filename
Diffstat (limited to 'service')
-rw-r--r--service/test/integration/test_leap_mailstore.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/service/test/integration/test_leap_mailstore.py b/service/test/integration/test_leap_mailstore.py
index c3d7b043..7a39e0c0 100644
--- a/service/test/integration/test_leap_mailstore.py
+++ b/service/test/integration/test_leap_mailstore.py
@@ -39,11 +39,11 @@ class LeapMailStoreTest(SoledadTestBase):
self.assertEqual(expected_mail_dict, result.as_dict())
@defer.inlineCallbacks
- def test_get_mail_with_lowercase_attachment(self):
+ def test_get_mail_with_attachment(self):
input_mail = MIMEMultipart()
input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8'))
attachment = MIMEApplication('pretend to be binary attachment data')
- attachment.add_header('content-disposition', 'attachment', filename='filename.txt')
+ attachment.add_header('Content-Disposition', 'attachment', filename='filename.txt')
input_mail.attach(attachment)
mail = yield self.mail_store.add_mail('INBOX', input_mail.as_string())
@@ -51,7 +51,7 @@ class LeapMailStoreTest(SoledadTestBase):
self.assertTrue(fetched_mail.as_dict()['attachments'])
@defer.inlineCallbacks
- def test_get_mail_with_attachment(self):
+ def test_attachment_name(self):
input_mail = MIMEMultipart()
input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8'))
attachment = MIMEApplication('pretend to be binary attachment data')
@@ -60,14 +60,15 @@ class LeapMailStoreTest(SoledadTestBase):
mail = yield self.mail_store.add_mail('INBOX', input_mail.as_string())
fetched_mail = yield self.mail_store.get_mail(mail.ident, include_body=True)
- self.assertTrue(fetched_mail.as_dict()['attachments'])
+ fetched_attachment_name = fetched_mail.as_dict()['attachments'][0]['name']
+ self.assertEqual(fetched_attachment_name, 'filename.txt')
@defer.inlineCallbacks
- def test_attachment_name(self):
+ def test_attachment_name_with_lowercase_header(self):
input_mail = MIMEMultipart()
input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8'))
attachment = MIMEApplication('pretend to be binary attachment data')
- attachment.add_header('Content-Disposition', 'attachment', filename='filename.txt')
+ attachment.add_header('content-disposition', 'attachment', filename='filename.txt')
input_mail.attach(attachment)
mail = yield self.mail_store.add_mail('INBOX', input_mail.as_string())