web/test/unittest_application.py
branchstable
changeset 7224 e5833657c646
parent 7163 d6d905d0344f
child 7235 5a0ee8de7f06
--- a/web/test/unittest_application.py	Wed Apr 13 14:02:04 2011 +0200
+++ b/web/test/unittest_application.py	Thu Apr 14 14:19:21 2011 +0200
@@ -334,7 +334,7 @@
         self.assertRaises(AuthenticationError, self.app_publish, req, 'login')
         self.assertEqual(req.cnx, None)
         authstr = base64.encodestring('%s:%s' % (self.admlogin, self.admpassword))
-        req._headers['Authorization'] = 'basic %s' % authstr
+        req.set_request_header('Authorization', 'basic %s' % authstr)
         self.assertAuthSuccess(req, origsession)
         self.assertRaises(LogOut, self.app_publish, req, 'logout')
         self.assertEqual(len(self.open_sessions), 0)
@@ -378,7 +378,8 @@
         cookie = Cookie.SimpleCookie()
         sessioncookie = self.app.session_handler.session_cookie(req)
         cookie[sessioncookie] = req.session.sessionid
-        req._headers['Cookie'] = cookie[sessioncookie].OutputString()
+        req.set_request_header('Cookie', cookie[sessioncookie].OutputString(),
+                               raw=True)
         clear_cache(req, 'get_authorization')
         # reset session as if it was a new incoming request
         req.session = req.cnx = None
@@ -403,10 +404,10 @@
         req, origsession = self.init_authentication('http', 'anon')
         self._test_auth_anon(req)
         authstr = base64.encodestring('toto:pouet')
-        req._headers['Authorization'] = 'basic %s' % authstr
+        req.set_request_header('Authorization', 'basic %s' % authstr)
         self._test_anon_auth_fail(req)
         authstr = base64.encodestring('%s:%s' % (self.admlogin, self.admpassword))
-        req._headers['Authorization'] = 'basic %s' % authstr
+        req.set_request_header('Authorization', 'basic %s' % authstr)
         self.assertAuthSuccess(req, origsession)
         self.assertRaises(LogOut, self.app_publish, req, 'logout')
         self.assertEqual(len(self.open_sessions), 0)