summaryrefslogtreecommitdiff
path: root/Lib/test/test_email/test_email.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_email/test_email.py')
-rw-r--r--Lib/test/test_email/test_email.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index 61e23fcc42..d7e3dca1b6 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -590,6 +590,17 @@ class TestMessageAPI(TestEmailBase):
eq(msg.values(), ['One Hundred', 'Twenty', 'Three', 'Eleven'])
self.assertRaises(KeyError, msg.replace_header, 'Fourth', 'Missing')
+ def test_get_content_disposition(self):
+ msg = Message()
+ self.assertIsNone(msg.get_content_disposition())
+ msg.add_header('Content-Disposition', 'attachment',
+ filename='random.avi')
+ self.assertEqual(msg.get_content_disposition(), 'attachment')
+ msg.replace_header('Content-Disposition', 'inline')
+ self.assertEqual(msg.get_content_disposition(), 'inline')
+ msg.replace_header('Content-Disposition', 'InlinE')
+ self.assertEqual(msg.get_content_disposition(), 'inline')
+
# test_defect_handling:test_invalid_chars_in_base64_payload
def test_broken_base64_payload(self):
x = 'AwDp0P7//y6LwKEAcPa/6Q=9'
@@ -1640,6 +1651,10 @@ class TestMIMEText(unittest.TestCase):
msg = MIMEText('hello there', _charset='us-ascii')
eq(msg.get_charset().input_charset, 'us-ascii')
eq(msg['content-type'], 'text/plain; charset="us-ascii"')
+ # Also accept a Charset instance
+ msg = MIMEText('hello there', _charset=Charset('utf-8'))
+ eq(msg.get_charset().input_charset, 'utf-8')
+ eq(msg['content-type'], 'text/plain; charset="utf-8"')
def test_7bit_input(self):
eq = self.assertEqual