devtools/testlib.py
changeset 10259 2be01bb6f9de
parent 10112 ff7f86d8393d
child 10301 729f36a1bcfa
--- a/devtools/testlib.py	Mon Feb 16 10:38:50 2015 +0100
+++ b/devtools/testlib.py	Mon Feb 16 14:30:19 2015 +0100
@@ -315,6 +315,7 @@
         """provide a new RepoAccess object for a given user
 
         The access is automatically closed at the end of the test."""
+        login = unicode(login)
         access = RepoAccess(self.repo, login, self.requestcls)
         self._open_access.add(access)
         return access
@@ -646,9 +647,11 @@
             login = req
             assert not isinstance(self, type)
             req = self._admin_clt_cnx
+        if login is not None:
+            login = unicode(login)
         if password is None:
-            password = login.encode('utf8')
-        user = req.create_entity('CWUser', login=unicode(login),
+            password = login
+        user = req.create_entity('CWUser', login=login,
                                  upassword=password, **kwargs)
         req.execute('SET X in_group G WHERE X eid %%(x)s, G name IN(%s)'
                     % ','.join(repr(str(g)) for g in groups),