devtools/testlib.py
changeset 7436 28ec860c4436
parent 7398 26695dd703d8
parent 7434 17ef6f9efaa1
child 7439 8e1c58a212ad
--- a/devtools/testlib.py	Wed May 25 11:42:31 2011 +0200
+++ b/devtools/testlib.py	Wed May 25 13:39:08 2011 +0200
@@ -613,9 +613,9 @@
         return publisher
 
     requestcls = fake.FakeRequest
-    def request(self, rollbackfirst=False, **kwargs):
+    def request(self, rollbackfirst=False, url=None, **kwargs):
         """return a web ui request"""
-        req = self.requestcls(self.vreg, form=kwargs)
+        req = self.requestcls(self.vreg, url=url, form=kwargs)
         if rollbackfirst:
             self.websession.cnx.rollback()
         req.set_session(self.websession)
@@ -704,7 +704,7 @@
 
     def init_authentication(self, authmode, anonuser=None):
         self.set_auth_mode(authmode, anonuser)
-        req = self.request()
+        req = self.request(url='login')
         origsession = req.session
         req.session = req.cnx = None
         del req.execute # get back to class implementation
@@ -731,7 +731,8 @@
         self.assertIsInstance(req.session, dbapi.DBAPISession)
         self.assertEqual(req.session.cnx, None)
         self.assertIsInstance(req.cnx, (dbapi._NeedAuthAccessMock, NoneType))
-        self.assertEqual(len(self.open_sessions), nbsessions)
+        # + 1 since we should still have session without connection set
+        self.assertEqual(len(self.open_sessions), nbsessions + 1)
         clear_cache(req, 'get_authorization')
 
     # content validation #######################################################