Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-openid-auth
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-openid-auth
Commits
6764d4c7
Commit
6764d4c7
authored
Mar 21, 2011
by
Michael Hall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add another test to make sure renaming doesn't get confused by not-quite nickna me+1 usernames
parent
bef0509f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
1 deletions
+38
-1
django_openid_auth/tests/test_views.py
+38
-1
No files found.
django_openid_auth/tests/test_views.py
View file @
6764d4c7
...
@@ -303,7 +303,6 @@ class RelyingPartyTests(TestCase):
...
@@ -303,7 +303,6 @@ class RelyingPartyTests(TestCase):
sreg_request
,
openid_resp
)
sreg_request
,
openid_resp
)
openid_response
.
addExtension
(
sreg_response
)
openid_response
.
addExtension
(
sreg_response
)
response
=
self
.
complete
(
openid_response
)
response
=
self
.
complete
(
openid_response
)
# self.assertEqual(openid_resp, (response.status_code, response.content))
self
.
assertRedirects
(
response
,
'http://testserver/getuser/'
)
self
.
assertRedirects
(
response
,
'http://testserver/getuser/'
)
def
test_login_without_nickname
(
self
):
def
test_login_without_nickname
(
self
):
...
@@ -389,6 +388,44 @@ class RelyingPartyTests(TestCase):
...
@@ -389,6 +388,44 @@ class RelyingPartyTests(TestCase):
self
.
assertEquals
(
user
.
last_name
,
'User'
)
self
.
assertEquals
(
user
.
last_name
,
'User'
)
self
.
assertEquals
(
user
.
email
,
'rename@example.com'
)
self
.
assertEquals
(
user
.
email
,
'rename@example.com'
)
def
test_login_follow_rename_false_onlyonce
(
self
):
settings
.
OPENID_FOLLOW_RENAMES
=
True
settings
.
OPENID_UPDATE_DETAILS_FROM_SREG
=
True
# Setup existing user who's name we're going to switch to
user
=
User
.
objects
.
create_user
(
'testuser'
,
'someone@example.com'
)
UserOpenID
.
objects
.
get_or_create
(
user
=
user
,
claimed_id
=
'http://example.com/existing_identity'
,
display_id
=
'http://example.com/existing_identity'
)
# Setup user who is going to try to change username to 'testuser'
renamed_user
=
User
.
objects
.
create_user
(
'testuser2000eight'
,
'someone@example.com'
)
UserOpenID
.
objects
.
get_or_create
(
user
=
renamed_user
,
claimed_id
=
'http://example.com/identity'
,
display_id
=
'http://example.com/identity'
)
# identity url is for 'testuser2000'
openid_req
=
{
'openid_identifier'
:
'http://example.com/identity'
,
'next'
:
'/getuser/'
}
# but returned username is for 'testuser', which already exists for another identity
openid_resp
=
{
'nickname'
:
'testuser2'
,
'fullname'
:
'Rename User'
,
'email'
:
'rename@example.com'
}
self
.
_do_user_login
(
openid_req
,
openid_resp
)
response
=
self
.
client
.
get
(
'/getuser/'
)
# If OPENID_FOLLOW_RENAMES, attempt to change username to 'testuser'
# but since that username is already taken by someone else, we go through
# the process of adding +i to it. Since the user for this identity url
# already has a name matching that pattern, check if first.
self
.
assertEquals
(
response
.
content
,
'testuser2'
)
# The user's full name and email have been updated.
user
=
User
.
objects
.
get
(
username
=
response
.
content
)
self
.
assertEquals
(
user
.
first_name
,
'Rename'
)
self
.
assertEquals
(
user
.
last_name
,
'User'
)
self
.
assertEquals
(
user
.
email
,
'rename@example.com'
)
def
test_login_follow_rename_conflict_onlyonce
(
self
):
def
test_login_follow_rename_conflict_onlyonce
(
self
):
settings
.
OPENID_FOLLOW_RENAMES
=
True
settings
.
OPENID_FOLLOW_RENAMES
=
True
settings
.
OPENID_UPDATE_DETAILS_FROM_SREG
=
True
settings
.
OPENID_UPDATE_DETAILS_FROM_SREG
=
True
...
...
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