[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.
--- 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)