[devtools] make CubicWebTC.login as admin undo previous logins
Fixes things when login is not used as a context manager.
--- a/devtools/testlib.py Tue Jan 14 17:30:13 2014 +0100
+++ b/devtools/testlib.py Tue Jan 14 17:30:02 2014 +0100
@@ -337,8 +337,9 @@
"""return a connection for the given login/password"""
__ = kwargs.pop('autoclose', True) # not used anymore
if login == self.admlogin:
- # definitly don't want autoclose when used as a context manager
- clt_cnx = repoapi.ClientConnection(self._admin_session)
+ # undo any previous login, if we're not used as a context manager
+ self.restore_connection()
+ return self.cnx
else:
if not kwargs:
kwargs['password'] = str(login)