Author: bree
Date: Thu Mar  9 18:46:47 2006
New Revision: 2562

Modified:
   azax/branches/snowsprint/__init__.py
   azax/branches/snowsprint/tests/test_azaxview.py
Log:
fix tests for unicode handling

Modified: azax/branches/snowsprint/__init__.py
==============================================================================
--- azax/branches/snowsprint/__init__.py        (original)
+++ azax/branches/snowsprint/__init__.py        Thu Mar  9 18:46:47 2006
@@ -3,4 +3,4 @@
 mimetypes.types_map['.kkt'] = 'text/xml' 
 
 from azaxview import AzaxBaseView
-from unicode_quirks import force_unicode
+from unicode_quirks import force_unicode, AzaxUnicodeError

Modified: azax/branches/snowsprint/tests/test_azaxview.py
==============================================================================
--- azax/branches/snowsprint/tests/test_azaxview.py     (original)
+++ azax/branches/snowsprint/tests/test_azaxview.py     Thu Mar  9 18:46:47 2006
@@ -22,7 +22,7 @@
 import unittest, os
 from zope.testing import doctest
 from Testing.ZopeTestCase import ZopeTestCase
-from Products.azax import AzaxBaseView
+from Products.azax import AzaxBaseView, AzaxUnicodeError
 from Products.azax import config 
 from ZPublisher.HTTPRequest import HTTPRequest
 from cStringIO import StringIO
@@ -127,6 +127,14 @@
         
     def test_setHtmlAsChildTextTagPlusText(self):
         self._checkSetHtmlResult('before<p 
xmlns="http://www.w3.org/1999/xhtml";>new_content</p>after')
+        
+    def test_setHtmlAcceptsUnicode(self):
+        'Test that it accepts unicode'
+        self._checkSetHtmlResult(u'abc�')
+        
+    def test_setHtmlChecksForNonUnicode(self):
+        'Test that it does not accept non unicode (unless pure ascii)'
+        self.assertRaises(AzaxUnicodeError, self._checkSetHtmlResult, 'abc�')
 
 class FTestAzaxView(AzaxViewTestCase):
     'Functional tests'
@@ -151,7 +159,7 @@
     def test_empty(self):
         view = self.view
         result = view.render()
-        self.assertEquals(view.request.response.getHeader('Content-Type'), 
'text/xml')
+        self.assertEquals(view.request.response.getHeader('Content-Type'), 
'text/xml;charset=utf-8')
         self.assertCommandsEqual(result, '')
     
     def test_setHtmlAsChild(self):
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to