[CMF-checkins] CVS: Products/CMFDefault/tests - test_utils.py:1.15

Tres Seaver tseaver at palladion.com
Thu Jul 7 16:08:14 EDT 2005


Update of /cvs-repository/Products/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv2606/CMFDefault/tests

Modified Files:
	test_utils.py 
Log Message:
 - Forward port fix for collector #230 from 1.5 branch.


=== Products/CMFDefault/tests/test_utils.py 1.14 => 1.15 ===
--- Products/CMFDefault/tests/test_utils.py:1.14	Wed Jun 15 10:17:39 2005
+++ Products/CMFDefault/tests/test_utils.py	Thu Jul  7 16:08:14 2005
@@ -170,6 +170,64 @@
         self.assertEqual( toUnicode( {'foo': 'bar'}, 'iso-8859-1' ),
                           {'foo': u'bar'} )
 
+    def test_formatRFC822Headers_simple(self):
+        from Products.CMFDefault.utils import formatRFC822Headers
+
+        HEADERS = [ ('Foo', 'foo')
+                  , ('Bar', 'bar')
+                  ]
+
+        formatted = formatRFC822Headers( HEADERS )
+
+        self.assertEqual( formatted, 'Foo: foo\r\nBar: bar' )
+
+    def test_formatRFC822Headers_empty(self):
+        from Products.CMFDefault.utils import formatRFC822Headers
+
+        HEADERS = [ ('Foo', 'foo')
+                  , ('Bar', '')
+                  ]
+
+        formatted = formatRFC822Headers( HEADERS )
+
+        self.assertEqual( formatted, 'Foo: foo\r\nBar: ' )
+
+    def test_formatRFC822Headers_multiline(self):
+        from Products.CMFDefault.utils import formatRFC822Headers
+
+        HEADERS = [ ('Foo', 'foo')
+                  , ('Bar', 'bar\nwith multiline')
+                  ]
+
+        formatted = formatRFC822Headers( HEADERS )
+
+        self.assertEqual( formatted
+                        , 'Foo: foo\r\nBar: bar\r\n  with multiline' )
+
+    def test_formatRFC822Headers_multiline_trailing_blank_line(self):
+        from Products.CMFDefault.utils import formatRFC822Headers
+
+        HEADERS = [ ('Foo', 'foo')
+                  , ('Bar', 'bar\nwith multiline\n')
+                  ]
+
+        formatted = formatRFC822Headers( HEADERS )
+
+        self.assertEqual( formatted
+                        , 'Foo: foo\r\nBar: bar\r\n  with multiline' )
+
+    def test_formatRFC822Headers_multiline_intermediate_blank_line(self):
+        from Products.CMFDefault.utils import formatRFC822Headers
+
+        HEADERS = [ ('Foo', 'foo')
+                  , ('Bar', 'bar\n\nwith multiline')
+                  ]
+
+        formatted = formatRFC822Headers( HEADERS )
+
+        self.assertEqual( formatted
+                        , 'Foo: foo\r\nBar: bar\r\n  \r\n  with multiline' )
+
 
 def test_suite():
     return makeSuite(DefaultUtilsTests)



More information about the CMF-checkins mailing list