diff options
author | Gislene Pereira <gislene01@gmail.com> | 2015-12-29 17:13:59 -0300 |
---|---|---|
committer | Gislene Pereira <gislene01@gmail.com> | 2015-12-29 17:13:59 -0300 |
commit | 22ab584f81b598e1aa61ae86b27b08459b589b16 (patch) | |
tree | 60891d09a4f343697ac07dd23ea3d54011a970ff /service/test/unit/adapter | |
parent | 4f0b8e6b062d54c99e398d43e34ac857ad1c9e3c (diff) |
Issue #562 - Capture inline attachments from Content Disposition.
Diffstat (limited to 'service/test/unit/adapter')
-rw-r--r-- | service/test/unit/adapter/mailstore/test_leap_mailstore.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/service/test/unit/adapter/mailstore/test_leap_mailstore.py b/service/test/unit/adapter/mailstore/test_leap_mailstore.py index a2f2d935..6cc58513 100644 --- a/service/test/unit/adapter/mailstore/test_leap_mailstore.py +++ b/service/test/unit/adapter/mailstore/test_leap_mailstore.py @@ -242,6 +242,21 @@ class TestLeapMailStore(TestCase): self.assertEqual(expected, message.as_dict()['attachments']) @defer.inlineCallbacks + def test_add_mail_with_inline_attachment(self): + input_mail = MIMEMultipart() + input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8')) + attachment = MIMEApplication('pretend to be an inline attachment') + attachment.add_header('Content-Disposition', 'u\'inline;\n\tfilename=super_nice_photo.jpg') + input_mail.attach(attachment) + mocked_message = self._add_create_mail_mocks_to_soledad(input_mail) + store = LeapMailStore(self.soledad) + + message = yield store.add_mail('INBOX', input_mail.as_string()) + + expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'super_nice_photo.jpg', 'encoding': 'base64'}] + self.assertEqual(expected, message.as_dict()['attachments']) + + @defer.inlineCallbacks def test_add_mail_with_nested_attachments(self): input_mail = MIMEMultipart() input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8')) |