1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00

Fix python3 compatbility in EmailMessageTestCase

This commit is contained in:
Adam Dobrawy 2016-04-09 23:01:12 +02:00
parent d3189fea20
commit 22c2f01e90

View file

@ -2,6 +2,7 @@ import email
import os
from os.path import dirname, join
import time
import six
from django.conf import settings
from django.test import TestCase
@ -59,7 +60,10 @@ class EmailMessageTestCase(TestCase):
def _get_email_object(self, name):
with open(join(dirname(__file__), 'messages', name), 'rb') as f:
return email.message_from_file(f)
if six.PY3:
return email.message_from_binary_file(f)
else:
return email.message_from_file(f)
def _headers_identical(self, left, right, header=None):
""" Check if headers are (close enough to) identical.