summaryrefslogtreecommitdiffstats
path: root/Lib/email/test
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2004-08-16 15:47:34 (GMT)
committerBarry Warsaw <barry@python.org>2004-08-16 15:47:34 (GMT)
commit06fa0420343c7e1f258610942e867918b580640f (patch)
treead2ee3b137c57577e815771e96ac4515bcdac455 /Lib/email/test
parentd4ff2069068278cb61167e5b38de642980606018 (diff)
downloadcpython-06fa0420343c7e1f258610942e867918b580640f.zip
cpython-06fa0420343c7e1f258610942e867918b580640f.tar.gz
cpython-06fa0420343c7e1f258610942e867918b580640f.tar.bz2
Test cases and fixes for bugs described in patch #873418: email/Message.py:
del_param fails when specifying a header.
Diffstat (limited to 'Lib/email/test')
-rw-r--r--Lib/email/test/test_email.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index 4479fb2..d079b9e 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -354,6 +354,12 @@ class TestMessageAPI(TestEmailBase):
('boundary', 'D1690A7AC1.996856090/mail.example.com'),
('report-type', old_val)])
+ def test_del_param_on_other_header(self):
+ msg = Message()
+ msg.add_header('Content-Disposition', 'attachment', filename='bud.gif')
+ msg.del_param('filename', 'content-disposition')
+ self.assertEqual(msg['content-disposition'], 'attachment')
+
def test_set_type(self):
eq = self.assertEqual
msg = Message()
@@ -365,6 +371,12 @@ class TestMessageAPI(TestEmailBase):
msg.set_type('text/html')
eq(msg['content-type'], 'text/html; charset="us-ascii"')
+ def test_set_type_on_other_header(self):
+ msg = Message()
+ msg['X-Content-Type'] = 'text/plain'
+ msg.set_type('application/octet-stream', 'X-Content-Type')
+ self.assertEqual(msg['x-content-type'], 'application/octet-stream')
+
def test_get_content_type_missing(self):
msg = Message()
self.assertEqual(msg.get_content_type(), 'text/plain')