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.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index 84f4e383f9..894b8003cd 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
@@ -3164,10 +3179,7 @@ Foo
self.msgids = []
append = self.msgids.append
make_msgid = utils.make_msgid
- try:
- clock = time.monotonic
- except AttributeError:
- clock = time.time
+ clock = time.monotonic
tfin = clock() + 3.0
while clock() < tfin:
append(make_msgid(domain='testdomain-string'))