mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Added failing test showing that unicode attachments cause an error
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
from datetime import date, datetime, timedelta, tzinfo
|
from datetime import date, datetime, timedelta, tzinfo
|
||||||
from email.mime.base import MIMEBase
|
from email.mime.base import MIMEBase
|
||||||
@@ -177,6 +179,24 @@ class DjrillBackendTests(DjrillBackendMockAPITestCase):
|
|||||||
# Make sure the image attachment is not treated as embedded:
|
# Make sure the image attachment is not treated as embedded:
|
||||||
self.assertFalse('images' in data['message'])
|
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(
|
||||||
|
subject='Subject',
|
||||||
|
body='Body goes here',
|
||||||
|
from_email='from@example.com',
|
||||||
|
to=['to1@example.com'],
|
||||||
|
attachments=unicode_attachment,
|
||||||
|
)
|
||||||
|
|
||||||
|
email.send()
|
||||||
|
data = self.get_api_call_data()
|
||||||
|
|
||||||
|
attachments = data['message']['attachments']
|
||||||
|
self.assertEqual(len(attachments), 1)
|
||||||
|
|
||||||
def test_embedded_images(self):
|
def test_embedded_images(self):
|
||||||
image_data = self.sample_image_content() # Read from a png file
|
image_data = self.sample_image_content() # Read from a png file
|
||||||
image_cid = make_msgid("img") # Content ID per RFC 2045 section 7 (with <...>)
|
image_cid = make_msgid("img") # Content ID per RFC 2045 section 7 (with <...>)
|
||||||
|
|||||||
Reference in New Issue
Block a user