Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
oauth
Commits
2c5a651f26c9
Commit
5bab08d1
authored
Jul 03, 2014
by
Christophe de Vienne
Browse files
Make sure get_next_login returns a unicode string.
Closes #4085738
parent
e044c0233717
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/test_oauth.py
View file @
2c5a651f
...
...
@@ -205,6 +205,37 @@ class OAuthTC(CubicWebTestTC):
rset
=
cnx
.
execute
(
'Any X WHERE X login "afname.aname"'
)
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
set_next_me
(
me
):
FakeRequestRession
.
return_value
=
mock
.
Mock
()
...
...
views.py
View file @
2c5a651f
...
...
@@ -53,7 +53,7 @@ def get_next_login(login):
index
=
int
(
m
.
group
(
'index'
))
+
1
else
:
index
=
1
return
'{}.{}'
.
format
(
login
,
index
)
return
u
'{}.{}'
.
format
(
login
,
index
)
class
ExternalAuthMixin
(
object
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment