Author: chrisz
Date: Tue Jan 11 09:37:21 2011
New Revision: 7202
URL: http://trac.turbogears.org/changeset/7202

Log:
Adapt tests to sometimes different content type and status in CherryPy 3.2.

Modified:
   branches/1.5/turbogears/tests/test_controllers.py

Modified: branches/1.5/turbogears/tests/test_controllers.py
==============================================================================
--- branches/1.5/turbogears/tests/test_controllers.py   Tue Jan 11 09:22:48 
2011        (r7201)
+++ branches/1.5/turbogears/tests/test_controllers.py   Tue Jan 11 09:37:21 
2011        (r7202)
@@ -327,7 +327,8 @@
 
     def test_allow_json(self):
         response = self.app.get('/allowjson?tg_format=json', status=404)
-        assert response.headers['Content-Type'] == 'text/html'
+        assert response.headers['Content-Type'] in ('text/html',
+            'text/html;charset=utf-8')
 
     def test_allow_json_config(self):
         """JSON output can be enabled via config."""
@@ -355,7 +356,8 @@
         testutil.start_server()
         response = app.get('/allowjsonconfig')
         response = app.get('/allowjsonconfig?tg_format=json', status=404)
-        assert response.headers['Content-Type'] == 'text/html'
+        assert response.headers['Content-Type'] in ('text/html',
+            'text/html;charset=utf-8')
         config.update({'tg.allow_json': True})
 
     def test_json_error(self):
@@ -748,7 +750,8 @@
         """If there is no trailing slash on an index method call, redirect"""
         testutil.mount(SubApp(), '/')
         testutil.mount(SubApp(), '/foo')
-        self.app.get('/foo', status=302)
+        # CherryPy 3.1 gives 302, CherryPy 3.2 gives 301
+        self.app.get('/foo', status=(301, 302))
 
     def test_can_use_internally_defined_arguments(self):
         """Can use argument names that are internally used by TG in 
controllers"""

Reply via email to