Add Attachment.content_type

This commit is contained in:
medmunds
2020-09-10 15:08:52 -07:00
committed by Mike Edmunds
parent 5b04ae30f2
commit be7f2516b0
2 changed files with 10 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import base64
import copy
import pickle
from email.mime.image import MIMEImage
from email.mime.text import MIMEText
from django.http import QueryDict
from django.test import SimpleTestCase, RequestFactory, override_settings
@@ -217,6 +218,11 @@ class NormalizedAttachmentTests(SimpleTestCase):
self.assertFalse(att.inline)
self.assertIsNone(att.content_id) # ignored for non-inline Attachment
def test_content_type(self):
att = Attachment(MIMEText("text", "plain", "iso8859-1"), "ascii")
self.assertEqual(att.mimetype, "text/plain")
self.assertEqual(att.content_type, 'text/plain; charset="iso8859-1"')
class LazyCoercionTests(SimpleTestCase):
"""Test utils.is_lazy and force_non_lazy*"""