]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
test_boundary_with_leading_space(): Test case for SF bug #1060941. RFC 2046
authorBarry Warsaw <barry@python.org>
Sat, 6 Nov 2004 00:04:20 +0000 (00:04 +0000)
committerBarry Warsaw <barry@python.org>
Sat, 6 Nov 2004 00:04:20 +0000 (00:04 +0000)
says boundaries may begin -- but not end -- with whitespace.

I will backport to Python 2.3.

Lib/email/test/test_email.py

index 745260ed985f541d2d2eceea8d0518278f75c91d..2fcd859ab88231dd521b94670ea1baf0d8347b97 100644 (file)
@@ -1332,6 +1332,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)
+
 
 \f
 # Test some badly formatted messages