Commit 5bab08d1 authored by Christophe de Vienne's avatar Christophe de Vienne
Browse files

Make sure get_next_login returns a unicode string.

Closes #4085738
parent e044c0233717
...@@ -205,6 +205,37 @@ class OAuthTC(CubicWebTestTC): ...@@ -205,6 +205,37 @@ class OAuthTC(CubicWebTestTC):
rset = cnx.execute('Any X WHERE X login "afname.aname"') rset = cnx.execute('Any X WHERE X login "afname.aname"')
self.assertEqual(1, rset.rowcount) self.assertEqual(1, rset.rowcount)
def test_same_login_creation(self):
def set_next_me(me):
FakeRequestRession.return_value = mock.Mock()
FakeRequestRession.return_value.json.return_value = me
set_next_me({
'id': u'1112',
'name': u'Achille Zavata',
'last_name': u'AName',
'first_name': u'AFName',
'username': u'zeuser',
'email': u'zeuser@example.com'})
self.login()
with self.admin_access.repo_cnx() as cnx:
rset = cnx.execute('Any X WHERE X login "achille.zavata"')
self.assertEqual(1, rset.rowcount)
set_next_me({
'id': u'1113',
'name': u'Achille Zavata',
'last_name': u'AName',
'first_name': u'AFName',
'username': u'zeuser',
'email': u'zeuser2@example.com'})
self.login()
with self.admin_access.repo_cnx() as cnx:
rset = cnx.execute('Any X WHERE X login "achille.zavata.1"')
self.assertEqual(1, rset.rowcount)
def test_various_creation(self): def test_various_creation(self):
def set_next_me(me): def set_next_me(me):
FakeRequestRession.return_value = mock.Mock() FakeRequestRession.return_value = mock.Mock()
......
...@@ -53,7 +53,7 @@ def get_next_login(login): ...@@ -53,7 +53,7 @@ def get_next_login(login):
index = int(m.group('index')) + 1 index = int(m.group('index')) + 1
else: else:
index = 1 index = 1
return '{}.{}'.format(login, index) return u'{}.{}'.format(login, index)
class ExternalAuthMixin(object): class ExternalAuthMixin(object):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment