mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
Always decode headers into unicode objects before assigning to model; fixes #12.
This commit is contained in:
parent
d3a766ffd6
commit
79e189fb22
5 changed files with 36 additions and 15 deletions
|
|
@ -21,7 +21,7 @@ Received: from [144.206.32.69] by e.mail.ru with HTTP;
|
|||
Mon, 21 Apr 2014 17:01:45 +0400
|
||||
From: =?UTF-8?B?dGVzdCB0ZXN0?= <mr.test32@mail.ru>
|
||||
To: mr.test32@yandex.ru
|
||||
Subject: Óçíàé êàê çàðàáàòûâàòü îò 1000$ â íåäåëþ!
|
||||
Subject: Узнай как зарабатывать от 1000$ в неделю!
|
||||
|
||||
Content-Type: text/html;
|
||||
charset="iso-8859-1"
|
||||
|
|
@ -174,3 +174,23 @@ class TestProcessEmail(EmailMessageTestCase):
|
|||
actual_body,
|
||||
expected_body,
|
||||
)
|
||||
|
||||
def test_message_with_single_byte_subject_encoding(self):
|
||||
email_object = self._get_email_object(
|
||||
'message_with_single_byte_extended_subject_encoding.eml',
|
||||
)
|
||||
|
||||
msg = self.mailbox.process_incoming_message(email_object)
|
||||
|
||||
expected_subject = (
|
||||
u'\xd3\xe7\xed\xe0\xe9 \xea\xe0\xea \xe7\xe0\xf0'
|
||||
u'\xe0\xe1\xe0\xf2\xfb\xe2\xe0\xf2\xfc \xee\xf2 1000$ '
|
||||
u'\xe2 \xed\xe5\xe4\xe5\xeb\xfe!'
|
||||
)
|
||||
actual_subject = msg.subject
|
||||
self.assertEqual(actual_subject, expected_subject)
|
||||
|
||||
expected_from = u'test test<mr.test32@mail.ru>'
|
||||
actual_from = msg.from_header
|
||||
|
||||
self.assertEqual(expected_from, actual_from)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue