Handle unicode attachment content in both python 2.X and python3.

This commit is contained in:
winhamwr
2014-04-23 16:59:48 -04:00
parent 4e0a0cca71
commit 70dc022f77
2 changed files with 15 additions and 13 deletions

View File

@@ -180,18 +180,17 @@ class DjrillBackendTests(DjrillBackendMockAPITestCase):
self.assertFalse('images' in data['message'])
def test_unicode_attachment_correctly_decoded(self):
unicode_attachment = [
('before_html.html', u'<p>\u2019</p>', 'text/html'),
]
email = mail.EmailMessage(
msg = mail.EmailMessage(
subject='Subject',
body='Body goes here',
from_email='from@example.com',
to=['to1@example.com'],
attachments=unicode_attachment,
)
# Slight modification from the Django unicode docs:
# http://django.readthedocs.org/en/latest/ref/unicode.html#email
msg.attach("Une pièce jointe.html", u'<p>\u2019</p>', mimetype='text/html')
email.send()
msg.send()
data = self.get_api_call_data()
attachments = data['message']['attachments']