1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-10 06:48: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:
Adam Coddington 2013-06-22 15:06:53 -07:00
parent 9cdb2d9d1b
commit 3ea8689ec0
2 changed files with 37 additions and 1 deletions

View file

@ -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
)