mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
Encode message body to bytes prior to reconstituting e-mail message object. Added additional test to ensure that messages can make it the full cycle.
This commit is contained in:
parent
9cdb2d9d1b
commit
3ea8689ec0
2 changed files with 37 additions and 1 deletions
|
|
@ -155,3 +155,25 @@ class TestGetMessage(EmailMessageTestCase):
|
|||
actual_text,
|
||||
expected_text
|
||||
)
|
||||
|
||||
|
||||
class TestMessageGetEmailObject(TestCase):
|
||||
def test_get_body_properly_handles_unicode_body(self):
|
||||
with open(
|
||||
os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'generic_message.eml'
|
||||
)
|
||||
) as f:
|
||||
unicode_body = unicode(f.read())
|
||||
|
||||
message = Message()
|
||||
message.body = unicode_body
|
||||
|
||||
expected_body = unicode_body
|
||||
actual_body = message.get_email_object().as_string()
|
||||
|
||||
self.assertEquals(
|
||||
expected_body,
|
||||
actual_body
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue