[Zope-Checkins] SVN: Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py more tests

Andreas Jung andreas at andreas-jung.com
Wed Dec 21 10:09:16 EST 2005


Log message for revision 40955:
  more tests
  

Changed:
  U   Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py

-=-
Modified: Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py	2005-12-21 15:03:12 UTC (rev 40954)
+++ Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py	2005-12-21 15:09:16 UTC (rev 40955)
@@ -1,3 +1,5 @@
+# -*- coding: iso-8859-15 -*-
+
 import unittest
 
 class HTTPResponseTests(unittest.TestCase):
@@ -85,7 +87,17 @@
     def test_CharsetApplicationHeader(self):
         response = self._makeOne(body='foo', headers={'content-type': 'application/foo'})
         self.assertEqual(response.headers.get('content-type'), 'application/foo; charset=iso-8859-15')
+    
+    def test_CharsetApplicationHeaderUnicode(self):
+        response = self._makeOne(body=unicode('ärger', 'iso-8859-15'), headers={'content-type': 'application/foo'})
+        self.assertEqual(response.headers.get('content-type'), 'application/foo; charset=iso-8859-15')
+        self.assertEqual(response.body, 'ärger')
 
+    def test_CharsetApplicationHeader1Unicode(self):
+        response = self._makeOne(body=unicode('ärger', 'iso-8859-15'), headers={'content-type': 'application/foo; charset=utf-8'})
+        self.assertEqual(response.headers.get('content-type'), 'application/foo; charset=utf-8')
+        self.assertEqual(response.body, unicode('ärger', 'iso-8859-15').encode('utf-8'))
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(HTTPResponseTests, 'test'))



More information about the Zope-Checkins mailing list