diff options
author | Barry Warsaw <barry@python.org> | 2001-10-19 04:08:59 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-10-19 04:08:59 (GMT) |
commit | 1f0fa92b0a1ba551c40dcd1dc0bb637e74320531 (patch) | |
tree | 0f83785ee1d5c2904b60b7cc8947c2e6e6b272b0 /Lib/test | |
parent | 11ce5505784f5e022057e69e4b6f567dd7fb7d16 (diff) | |
download | cpython-1f0fa92b0a1ba551c40dcd1dc0bb637e74320531.zip cpython-1f0fa92b0a1ba551c40dcd1dc0bb637e74320531.tar.gz cpython-1f0fa92b0a1ba551c40dcd1dc0bb637e74320531.tar.bz2 |
Another merge from mimelib:
TestMIMEMessage.test_epilogue(), TestIdempotent.test_preamble_epilogue():
Test cases for SF bug #472481.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_email.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py index 4298ec2..b2dfce4 100644 --- a/Lib/test/test_email.py +++ b/Lib/test/test_email.py @@ -26,6 +26,7 @@ from email import Iterators import test_email from test_support import findfile + NL = '\n' EMPTYSTRING = '' SPACE = ' ' @@ -696,6 +697,28 @@ Your message cannot be delivered to the following recipients: eq(subsubpart['message-id'], '<002001c144a6$8752e060$56104586@oxy.edu>') + def test_epilogue(self): + fp = openfile('msg_21.txt') + try: + text = fp.read() + finally: + fp.close() + msg = Message() + msg['From'] = 'aperson@dom.ain' + msg['To'] = 'bperson@dom.ain' + msg['Subject'] = 'Test' + msg.preamble = 'MIME message\n' + msg.epilogue = 'End of MIME message\n' + msg1 = MIMEText('One') + msg2 = MIMEText('Two') + msg.add_header('Content-Type', 'multipart/mixed', boundary='BOUNDARY') + msg.add_payload(msg1) + msg.add_payload(msg2) + sfp = StringIO() + g = Generator(sfp) + g(msg) + self.assertEqual(sfp.getvalue(), text) + # A general test of parser->model->generator idempotency. IOW, read a message @@ -760,6 +783,10 @@ class TestIdempotent(unittest.TestCase): msg, text = self._msgobj('msg_16.txt') self._idempotent(msg, text) + def test_preamble_epilogue(self): + msg, text = self._msgobj('msg_21.txt') + self._idempotent(msg, text) + def test_content_type(self): eq = self.assertEquals # Get a message object and reset the seek pointer for other tests |