From: Barry Warsaw Date: Sat, 6 Nov 2004 00:13:46 +0000 (+0000) Subject: test_boundary_with_leading_space(): Test case for SF bug #1060941. RFC 2046 X-Git-Tag: v2.3.5c1~77 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8bd9db292d3da89dd9d707c52eece2d931cb2339;p=thirdparty%2FPython%2Fcpython.git test_boundary_with_leading_space(): Test case for SF bug #1060941. RFC 2046 says boundaries may begin -- but not end -- with whitespace. --- diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index 8204f463c89a..c69c25871ca9 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -1203,6 +1203,25 @@ Content-Transfer-Encoding: 7Bit ----961284236552522269-- ''') + def test_boundary_with_leading_space(self): + eq = self.assertEqual + msg = email.message_from_string('''\ +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary=" XXXX" + +-- XXXX +Content-Type: text/plain + + +-- XXXX +Content-Type: text/plain + +-- XXXX-- +''') + self.failUnless(msg.is_multipart()) + eq(msg.get_boundary(), ' XXXX') + eq(len(msg.get_payload()), 2) + # Test some badly formatted messages