diff options
| author | Folker Bernitt <fbernitt@thoughtworks.com> | 2016-01-06 16:38:20 +0100 | 
|---|---|---|
| committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2016-01-06 16:38:20 +0100 | 
| commit | 9db569e3f5170efd852322d428b9b0282c7bb114 (patch) | |
| tree | d96e1a1601875ee052313e9ed626add3e94ca3bd /service/test | |
| parent | 9452ce26ea20ed73808c172cdef3890c45473e41 (diff) | |
Support attachments without name in Content-Disposition header
- Issue 557
- along the way also added support for signatures and
  attached keys
Diffstat (limited to 'service/test')
| -rw-r--r-- | service/test/unit/adapter/mailstore/test_leap_mailstore.py | 21 | 
1 files changed, 21 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 6cc58513..f4fa367f 100644 --- a/service/test/unit/adapter/mailstore/test_leap_mailstore.py +++ b/service/test/unit/adapter/mailstore/test_leap_mailstore.py @@ -292,6 +292,27 @@ class TestLeapMailStore(TestCase):          self.assertEqual('batatinha.rtf', attachment_info[0].name)          self.assertEqual('receipt.pdf', attachment_info[1].name) +    def test_extract_attachment_filename_from_other_headers(self): +        input_mail = MIMEMultipart() +        input_mail.attach(MIMEText(u'a utf8 message', _charset='utf-8')) + +        attachment_without_description = MIMEApplication('pretend to be an attachment from apple mail', _subtype='pgp-keys') +        attachment_without_description.add_header('Content-Disposition', 'attachment') +        attachment_without_description.add_header('Content-Description', 'Some GPG Key') + +        input_mail.attach(attachment_without_description) + +        attachment_with_name_in_content_type = MIMEApplication('pretend to be an attachment from thunderbird', _subtype='pgp-signature; name="signature.asc"') +        attachment_with_name_in_content_type.add_header('Content-Disposition', 'inline') +        input_mail.attach(attachment_with_name_in_content_type) + +        message = self._add_create_mail_mocks_to_soledad(input_mail) +        store = LeapMailStore(self.soledad) +        attachment_info = store._extract_attachment_info_from(message) + +        self.assertEqual('Some GPG Key', attachment_info[0].name) +        self.assertEqual('signature.asc', attachment_info[1].name) +      @defer.inlineCallbacks      def test_add_mail_with_special_chars(self):          input_mail = MIMEText(u'a utf8 message', _charset='utf-8') | 
