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
5bc9cb7a
Commit
5bc9cb7a
authored
Jan 25, 2010
by
James Henstridge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a high level test to show that requests without a "next" parameter pass.
parent
a3e5bcc9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
django_openid_auth/tests/test_views.py
+27
-0
No files found.
django_openid_auth/tests/test_views.py
View file @
5bc9cb7a
...
...
@@ -126,6 +126,7 @@ class RelyingPartyTests(TestCase):
self
.
provider
=
StubOpenIDProvider
(
'http://example.com/'
)
setDefaultFetcher
(
self
.
provider
,
wrap_exceptions
=
False
)
self
.
old_login_redirect_url
=
getattr
(
settings
,
'LOGIN_REDIRECT_URL'
,
'/accounts/profile/'
)
self
.
old_create_users
=
getattr
(
settings
,
'OPENID_CREATE_USERS'
,
False
)
self
.
old_update_details
=
getattr
(
settings
,
'OPENID_UPDATE_DETAILS_FROM_SREG'
,
False
)
self
.
old_sso_server_url
=
getattr
(
settings
,
'OPENID_SSO_SERVER_URL'
)
...
...
@@ -139,6 +140,7 @@ class RelyingPartyTests(TestCase):
settings
.
OPENID_USE_AS_ADMIN_LOGIN
=
False
def
tearDown
(
self
):
settings
.
LOGIN_REDIRECT_URL
=
self
.
old_login_redirect_url
settings
.
OPENID_CREATE_USERS
=
self
.
old_create_users
settings
.
OPENID_UPDATE_DETAILS_FROM_SREG
=
self
.
old_update_details
settings
.
OPENID_SSO_SERVER_URL
=
self
.
old_sso_server_url
...
...
@@ -190,6 +192,31 @@ class RelyingPartyTests(TestCase):
response
=
self
.
client
.
get
(
'/getuser/'
)
self
.
assertEquals
(
response
.
content
,
'someuser'
)
def
test_login_no_next
(
self
):
"""Logins with no next parameter redirect to LOGIN_REDIRECT_URL."""
user
=
User
.
objects
.
create_user
(
'someuser'
,
'someone@example.com'
)
useropenid
=
UserOpenID
(
user
=
user
,
claimed_id
=
'http://example.com/identity'
,
display_id
=
'http://example.com/identity'
)
useropenid
.
save
()
settings
.
LOGIN_REDIRECT_URL
=
'/getuser/'
response
=
self
.
client
.
post
(
'/openid/login/'
,
{
'openid_identifier'
:
'http://example.com/identity'
})
self
.
assertContains
(
response
,
'OpenID transaction in progress'
)
openid_request
=
self
.
provider
.
parseFormPost
(
response
.
content
)
self
.
assertEquals
(
openid_request
.
mode
,
'checkid_setup'
)
self
.
assertTrue
(
openid_request
.
return_to
.
startswith
(
'http://testserver/openid/complete/'
))
# Complete the request. The user is redirected to the next URL.
openid_response
=
openid_request
.
answer
(
True
)
response
=
self
.
complete
(
openid_response
)
self
.
assertRedirects
(
response
,
'http://testserver'
+
settings
.
LOGIN_REDIRECT_URL
)
def
test_login_sso
(
self
):
settings
.
OPENID_SSO_SERVER_URL
=
'http://example.com/identity'
user
=
User
.
objects
.
create_user
(
'someuser'
,
'someone@example.com'
)
...
...
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