summaryrefslogtreecommitdiffstats
path: root/Lib/email/test/test_email.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-09-10 15:46:44 (GMT)
committerBarry Warsaw <barry@python.org>2002-09-10 15:46:44 (GMT)
commit24d45df3f2a4e549fc115a77a250a98861c06750 (patch)
tree323e6a3614ed19549794453f627c3807a5b14766 /Lib/email/test/test_email.py
parentdad90c202aa7e1d14e489f63858d00a1056eda0c (diff)
downloadcpython-24d45df3f2a4e549fc115a77a250a98861c06750.zip
cpython-24d45df3f2a4e549fc115a77a250a98861c06750.tar.gz
cpython-24d45df3f2a4e549fc115a77a250a98861c06750.tar.bz2
test_splitting_first_line_only_is_long(): New test for SF bug #601392,
broken wrapping of long ASCII headers.
Diffstat (limited to 'Lib/email/test/test_email.py')
-rw-r--r--Lib/email/test/test_email.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index 8a9759c..0fe304b 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -687,6 +687,22 @@ from babylon.socal-raves.org (localhost [127.0.0.1]);
\tfor <mailman-admin@babylon.socal-raves.org>;
\tSat, 2 Feb 2002 17:00:06 -0800 (PST)""")
+ def test_splitting_first_line_only_is_long(self):
+ eq = self.ndiffAssertEqual
+ hstr = """\
+from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93] helo=cthulhu.gerg.ca)
+\tby kronos.mems-exchange.org with esmtp (Exim 4.05)
+\tid 17k4h5-00034i-00
+\tfor test@mems-exchange.org; Wed, 28 Aug 2002 11:25:20 -0400"""
+ h = Header(hstr, maxlinelen=78, header_name='Received',
+ continuation_ws='\t')
+ eq(h.encode(), """\
+from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93]
+\thelo=cthulhu.gerg.ca)
+\tby kronos.mems-exchange.org with esmtp (Exim 4.05)
+\tid 17k4h5-00034i-00
+\tfor test@mems-exchange.org; Wed, 28 Aug 2002 11:25:20 -0400""")
+
# Test mangling of "From " lines in the body of a message
@@ -1011,7 +1027,7 @@ class TestNonConformant(TestEmailBase):
data = fp.read()
finally:
fp.close()
- p = Parser()
+ p = Parser(strict=1)
# Note, under a future non-strict parsing mode, this would parse the
# message into the intended message tree.
self.assertRaises(Errors.BoundaryError, p.parsestr, data)
@@ -1045,6 +1061,23 @@ class TestNonConformant(TestEmailBase):
g.flatten(msg)
neq(s.getvalue(), 'Content-Type: foo\n\n')
+ def test_no_start_boundary(self):
+ eq = self.ndiffAssertEqual
+ msg = self._msgobj('msg_31.txt')
+ eq(msg.get_payload(), """\
+--BOUNDARY
+Content-Type: text/plain
+
+message 1
+
+--BOUNDARY
+Content-Type: text/plain
+
+message 2
+
+--BOUNDARY--
+""")
+
# Test RFC 2047 header encoding and decoding
@@ -1428,6 +1461,10 @@ class TestIdempotent(TestEmailBase):
msg, text = self._msgobj('msg_24.txt')
self._idempotent(msg, text)
+ def test_no_start_boundary(self):
+ msg, text = self._msgobj('msg_31.txt')
+ self._idempotent(msg, text)
+
def test_content_type(self):
eq = self.assertEquals
unless = self.failUnless