[web/test] properly reset the request connection related attribute
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 24 Jun 2013 18:35:22 +0200
changeset 9065 b1cad8e4557f
parent 9064 2e64254548ca
child 9066 685ca11d9870
[web/test] properly reset the request connection related attribute A new request does not have those attribute to None. There have special value that we now properly reinstall.
web/test/unittest_application.py
--- a/web/test/unittest_application.py	Mon Jun 24 18:23:48 2013 +0200
+++ b/web/test/unittest_application.py	Mon Jun 24 18:35:22 2013 +0200
@@ -30,6 +30,7 @@
 from cubicweb.web import LogOut, Redirect, INTERNAL_FIELD_VALUE
 from cubicweb.web.views.basecontrollers import ViewController
 from cubicweb.web.application import anonymized_request
+from cubicweb.dbapi import DBAPISession, _NeedAuthAccessMock
 
 class FakeMapping:
     """emulates a mapping module"""
@@ -366,7 +367,9 @@
                                raw=True)
         clear_cache(req, 'get_authorization')
         # reset session as if it was a new incoming request
-        req.session = req.cnx = None
+        req.session = DBAPISession(None)
+        req.user = req.cnx = _NeedAuthAccessMock
+        
 
     def _test_auth_anon(self, req):
         asession = self.app.get_session(req)