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
8e831f3b
Commit
8e831f3b
authored
Jun 18, 2013
by
Ricardo Kirkner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored tests to make sure account_verified reflects openid response
parent
fb446fbf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
24 deletions
+32
-24
django_openid_auth/tests/test_auth.py
+32
-24
No files found.
django_openid_auth/tests/test_auth.py
View file @
8e831f3b
...
@@ -192,37 +192,45 @@ class OpenIDBackendTests(TestCase):
...
@@ -192,37 +192,45 @@ class OpenIDBackendTests(TestCase):
self
.
assertEqual
(
"Some56789012345678901234567890"
,
user
.
first_name
)
self
.
assertEqual
(
"Some56789012345678901234567890"
,
user
.
first_name
)
self
.
assertEqual
(
"User56789012345678901234567890"
,
user
.
last_name
)
self
.
assertEqual
(
"User56789012345678901234567890"
,
user
.
last_name
)
def
test_update_user_openid_unverified
(
self
):
def
make_user
(
self
,
username
=
'someuser'
,
email
=
'someuser@example.com'
,
response
=
self
.
make_response_ax
()
password
=
None
):
user
=
User
.
objects
.
create_user
(
'someuser'
,
'someuser@example.com'
,
user
=
User
.
objects
.
create_user
(
username
,
email
,
password
=
password
)
password
=
None
)
return
user
def
make_user_openid
(
self
,
user
=
None
,
claimed_id
=
'http://example.com/existing_identity'
,
display_id
=
'http://example.com/existing_identity'
):
if
user
is
None
:
user
=
self
.
make_user
()
user_openid
,
created
=
UserOpenID
.
objects
.
get_or_create
(
user_openid
,
created
=
UserOpenID
.
objects
.
get_or_create
(
user
=
user
,
user
=
user
,
claimed_id
=
claimed_id
,
display_id
=
display_id
)
claimed_id
=
'http://example.com/existing_identity'
,
return
user_openid
display_id
=
'http://example.com/existing_identity'
,
account_verified
=
False
)
data
=
dict
(
first_name
=
u"Some56789012345678901234567890123"
,
last_name
=
u"User56789012345678901234567890123"
,
email
=
u"someotheruser@example.com"
,
account_verified
=
False
)
self
.
backend
.
update_user_details
(
user_openid
,
data
,
response
)
def
_test_account_verified
(
self
,
user_openid
,
verified
,
expected
):
self
.
assertFalse
(
user_openid
.
account_verified
)
# set user's verification status
user_openid
.
account_verified
=
verified
def
test_update_user_openid_verified
(
self
):
# get a response including verification status
response
=
self
.
make_response_ax
()
response
=
self
.
make_response_ax
()
user
=
User
.
objects
.
create_user
(
'someuser'
,
'someuser@example.com'
,
password
=
None
)
user_openid
,
created
=
UserOpenID
.
objects
.
get_or_create
(
user
=
user
,
claimed_id
=
'http://example.com/existing_identity'
,
display_id
=
'http://example.com/existing_identity'
,
account_verified
=
False
)
data
=
dict
(
first_name
=
u"Some56789012345678901234567890123"
,
data
=
dict
(
first_name
=
u"Some56789012345678901234567890123"
,
last_name
=
u"User56789012345678901234567890123"
,
last_name
=
u"User56789012345678901234567890123"
,
email
=
u"someotheruser@example.com"
,
account_verified
=
True
)
email
=
u"someotheruser@example.com"
,
account_verified
=
expected
)
self
.
backend
.
update_user_details
(
user_openid
,
data
,
response
)
self
.
backend
.
update_user_details
(
user_openid
,
data
,
response
)
self
.
assertTrue
(
user_openid
.
account_verified
)
# check the verification status
self
.
assertEqual
(
user_openid
.
account_verified
,
expected
)
def
test_update_user_openid_unverified
(
self
):
user_openid
=
self
.
make_user_openid
()
for
verified
in
(
False
,
True
):
self
.
_test_account_verified
(
user_openid
,
verified
,
expected
=
False
)
def
test_update_user_openid_verified
(
self
):
user_openid
=
self
.
make_user_openid
()
for
verified
in
(
False
,
True
):
self
.
_test_account_verified
(
user_openid
,
verified
,
expected
=
True
)
def
test_extract_user_details_name_with_trailing_space
(
self
):
def
test_extract_user_details_name_with_trailing_space
(
self
):
response
=
self
.
make_response_ax
(
fullname
=
"SomeUser "
)
response
=
self
.
make_response_ax
(
fullname
=
"SomeUser "
)
...
...
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