Commit f74304d2 authored by Andreas Jung's avatar Andreas Jung

more tests

parent bbc2547b
......@@ -91,6 +91,11 @@ class ZPTUnicodeEncodingConflictResolution(ZopeTestCase):
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',
......@@ -107,11 +112,21 @@ class ZPTUnicodeEncodingConflictResolution(ZopeTestCase):
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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment