forked from mirror/django-mailbox
Add test for message with not decoded attachment header
This commit is contained in:
parent
e766174fdd
commit
0e6dcce0f5
2 changed files with 51 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Received: by 10.221.0.211 with HTTP; Sun, 20 Jan 2013 12:07:07 -0800 (PST)
|
||||||
|
X-Originating-IP: [24.22.122.177]
|
||||||
|
Date: Sun, 20 Jan 2013 12:07:07 -0800
|
||||||
|
Delivered-To: test@adamcoddington.net
|
||||||
|
Message-ID: <CAMdmm+jYCgrxrekAxszmDnBjAytcBym-Ec+uM-+HEtzuKy=M_g@mail.gmail.com>
|
||||||
|
Subject: Message With Attachment
|
||||||
|
From: Adam Coddington <test@adamcoddington.net>
|
||||||
|
To: Adam Coddington <test@adamcoddington.net>
|
||||||
|
Content-Type: multipart/mixed; boundary=047d7b33dd729737fe04d3bde348
|
||||||
|
|
||||||
|
--047d7b33dd729737fe04d3bde348
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
|
||||||
|
This message has an attachment.
|
||||||
|
|
||||||
|
--047d7b33dd729737fe04d3bde348
|
||||||
|
Content-Type: image/png; name="ð̞oβ̞le.png"
|
||||||
|
Content-Disposition: attachment; filename="ð̞oβ̞le.png"
|
||||||
|
X-Attachment-Id: f_hc6mair60
|
||||||
|
Content-Transfer-Encoding: base64
|
||||||
|
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAFoTx1HAAAAzUlEQVQoz32RWxXDIBBEr4NIQEIl
|
||||||
|
ICESkFAJkRAJSIgEpEQCEqYfu6QUkn7sCcyDGQiSACKSKCAkGwBJwhDwZQNMEiYAIBdQvk7rfaHf
|
||||||
|
AO8NBJwCxTGhtFgTHVNaNaJeWFu44AXEHzKCktc7zZ0vss+bMoHSiM2b9mQoX1eZCgGqnWskY3gi
|
||||||
|
XXAAxb8BqFiUgBNY7k49Tu/kV7UKPsefrjEOT9GmghYzrk9V03pjDGYKj3d0c06dKZkpTboRaD9o
|
||||||
|
B+1m2m81d2Az948xzgdjLaFe95e83AAAAABJRU5ErkJggg==
|
||||||
|
|
||||||
|
--047d7b33dd729737fe04d3bde348--
|
||||||
|
|
@ -60,6 +60,28 @@ class TestProcessEmail(EmailMessageTestCase):
|
||||||
'heart.png',
|
'heart.png',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_message_with_not_decoded_attachment_header(self):
|
||||||
|
email_object = self._get_email_object(
|
||||||
|
'message_with_not_decoded_attachment_header.eml',
|
||||||
|
)
|
||||||
|
|
||||||
|
mailbox = Mailbox.objects.create()
|
||||||
|
msg = mailbox.process_incoming_message(email_object)
|
||||||
|
|
||||||
|
expected_count = 1
|
||||||
|
actual_count = msg.attachments.count()
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
expected_count,
|
||||||
|
actual_count,
|
||||||
|
)
|
||||||
|
|
||||||
|
attachment = msg.attachments.all()[0]
|
||||||
|
self.assertEqual(
|
||||||
|
attachment.get_filename(),
|
||||||
|
u'\xc3\xb0\xcc\x9eo\xce\xb2\xcc\x9ele.png',
|
||||||
|
)
|
||||||
|
|
||||||
def test_message_get_text_body(self):
|
def test_message_get_text_body(self):
|
||||||
message = self._get_email_object('multipart_text.eml')
|
message = self._get_email_object('multipart_text.eml')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue