Log message for revision 71831:
  more tests
  

Changed:
  U   Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py

-=-
Modified: 
Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py  
2007-01-08 20:38:26 UTC (rev 71830)
+++ Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py  
2007-01-08 20:59:25 UTC (rev 71831)
@@ -91,7 +91,12 @@
         zope.component.provideAdapter(DefaultTraversable, (None,))
         zope.component.provideAdapter(HTTPCharsets, (None,))
         provideUtility(PreferredCharsetResolver, 
IUnicodeEncodingConflictResolver)
+        transaction.begin()
 
+    def tearDown(self):
+        transaction.abort()
+        self.app._p_jar.close()
+
     def testISO_8859_15(self):
         manage_addPageTemplate(self.app, 'test', 
                                text='<div tal:content="python: 
request.get(\'data\')" />', 
@@ -107,12 +112,22 @@
                                text='<div tal:content="python: 
request.get(\'data\')" />', 
                                encoding='ascii')
         zpt = self.app['test']
-        self.app.REQUEST.set('HTTP_ACCEPT_CHARSET', 'ISO-8859-15,utf-8')
+        self.app.REQUEST.set('HTTP_ACCEPT_CHARSET', 'utf-8,ISO-8859-15')
         self.app.REQUEST.set('data', unicode('üöä', 
'iso-8859-15').encode('utf-8'))
         result = zpt.pt_render()
         self.assertEqual(result.startswith(unicode('<div>üöä</div>', 
'iso-8859-15')), True)
 
+    def testUTF8WrongPreferredCharset(self):
+        manage_addPageTemplate(self.app, 'test', 
+                               text='<div tal:content="python: 
request.get(\'data\')" />', 
+                               encoding='ascii')
+        zpt = self.app['test']
+        self.app.REQUEST.set('HTTP_ACCEPT_CHARSET', 'iso-8859-15')
+        self.app.REQUEST.set('data', unicode('üöä', 
'iso-8859-15').encode('utf-8'))
+        result = zpt.pt_render()
+        self.assertEqual(result.startswith(unicode('<div>üöä</div>', 
'iso-8859-15')), False)
 
+
 class ZopePageTemplateFileTests(ZopeTestCase):
 
     def testPT_RenderWithAscii(self):

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to