From 22a923ce862dd2b27aca0d2884507bf8826b6544 Mon Sep 17 00:00:00 2001 From: Adam Coddington Date: Mon, 16 Jan 2017 20:16:24 -0800 Subject: [PATCH] [#125] Adding @ad-m's test covering cyrillic attachments. --- django_mailbox/tests/test_process_email.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/django_mailbox/tests/test_process_email.py b/django_mailbox/tests/test_process_email.py index 5704d0f..36042c4 100644 --- a/django_mailbox/tests/test_process_email.py +++ b/django_mailbox/tests/test_process_email.py @@ -416,3 +416,17 @@ class TestProcessEmail(EmailMessageTestCase): msg = self.mailbox.record_outgoing_message(email_object) self.assertEqual(msg.attachments.all().count(), 1) + + def test_message_outgoing_cyrilic_constructed(self): + msg = EmailMessage( + 'subject', 'body', 'from@gmail.com', ['to@gmail.com'] + ) + + msg.attach( + '\xd0\xa2\xd0\xb0\xd0\xbd\xd0\xba\xd0\xb8.gif'.decode('utf-8'), + self._get_email_as_text('message_with_cyrillic_attachment.eml'), + 'image/gif' + ) + self.mailbox.record_outgoing_message(msg.message()) + + self.assertEqual(msg.attachments.all().count(), 1)