Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
40448e44
Commit
40448e44
authored
Oct 22, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address review comments and test failure
parent
f1bfa568
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
10 deletions
+14
-10
common/djangoapps/third_party_auth/tests/specs/base.py
+5
-8
common/djangoapps/third_party_auth/tests/specs/test_lti.py
+2
-0
common/djangoapps/third_party_auth/tests/testutil.py
+6
-1
common/djangoapps/third_party_auth/urls.py
+1
-1
No files found.
common/djangoapps/third_party_auth/tests/specs/base.py
View file @
40448e44
...
@@ -47,9 +47,6 @@ class IntegrationTestMixin(object):
...
@@ -47,9 +47,6 @@ class IntegrationTestMixin(object):
super
(
IntegrationTestMixin
,
self
)
.
setUp
()
super
(
IntegrationTestMixin
,
self
)
.
setUp
()
self
.
login_page_url
=
reverse
(
'signin_user'
)
self
.
login_page_url
=
reverse
(
'signin_user'
)
self
.
register_page_url
=
reverse
(
'register_user'
)
self
.
register_page_url
=
reverse
(
'register_user'
)
# Set the server name:
self
.
client
.
defaults
[
'SERVER_NAME'
]
=
'example.none'
# The SAML lib we use doesn't like testserver' as a domain
self
.
url_prefix
=
'http://example.none'
patcher
=
testutil
.
patch_mako_templates
()
patcher
=
testutil
.
patch_mako_templates
()
patcher
.
start
()
patcher
.
start
()
self
.
addCleanup
(
patcher
.
stop
)
self
.
addCleanup
(
patcher
.
stop
)
...
@@ -104,9 +101,9 @@ class IntegrationTestMixin(object):
...
@@ -104,9 +101,9 @@ class IntegrationTestMixin(object):
def
test_login
(
self
):
def
test_login
(
self
):
user
=
UserFactory
.
create
()
user
=
UserFactory
.
create
()
# The user goes to the login page, and sees a button to login with
TestShib
:
# The user goes to the login page, and sees a button to login with
this provider
:
provider_login_url
=
self
.
_check_login_page
()
provider_login_url
=
self
.
_check_login_page
()
# The user clicks on the
TestShib
button:
# The user clicks on the
provider's
button:
try_login_response
=
self
.
client
.
get
(
provider_login_url
)
try_login_response
=
self
.
client
.
get
(
provider_login_url
)
# The user should be redirected to the provider's login page:
# The user should be redirected to the provider's login page:
self
.
assertEqual
(
try_login_response
.
status_code
,
302
)
self
.
assertEqual
(
try_login_response
.
status_code
,
302
)
...
@@ -148,9 +145,9 @@ class IntegrationTestMixin(object):
...
@@ -148,9 +145,9 @@ class IntegrationTestMixin(object):
# Make sure we're not logged in:
# Make sure we're not logged in:
dashboard_response
=
self
.
client
.
get
(
reverse
(
'dashboard'
))
dashboard_response
=
self
.
client
.
get
(
reverse
(
'dashboard'
))
self
.
assertEqual
(
dashboard_response
.
status_code
,
302
)
self
.
assertEqual
(
dashboard_response
.
status_code
,
302
)
# The user goes to the login page, and sees a button to login with
TestShib
:
# The user goes to the login page, and sees a button to login with
this provider
:
provider_login_url
=
self
.
_check_login_page
()
provider_login_url
=
self
.
_check_login_page
()
# The user clicks on the
TestShib
button:
# The user clicks on the
provider's login
button:
try_login_response
=
self
.
client
.
get
(
provider_login_url
)
try_login_response
=
self
.
client
.
get
(
provider_login_url
)
# The user should be redirected to the provider:
# The user should be redirected to the provider:
self
.
assertEqual
(
try_login_response
.
status_code
,
302
)
self
.
assertEqual
(
try_login_response
.
status_code
,
302
)
...
@@ -164,7 +161,7 @@ class IntegrationTestMixin(object):
...
@@ -164,7 +161,7 @@ class IntegrationTestMixin(object):
if
user_is_activated
:
if
user_is_activated
:
url_expected
=
reverse
(
'dashboard'
)
url_expected
=
reverse
(
'dashboard'
)
else
:
else
:
url_expected
=
'/auth/inactive?next=/dashboard'
url_expected
=
reverse
(
'third_party_inactive_redirect'
)
+
'?next='
+
reverse
(
'dashboard'
)
self
.
assertEqual
(
login_response
[
'Location'
],
self
.
url_prefix
+
url_expected
)
self
.
assertEqual
(
login_response
[
'Location'
],
self
.
url_prefix
+
url_expected
)
# Now we are logged in:
# Now we are logged in:
dashboard_response
=
self
.
client
.
get
(
reverse
(
'dashboard'
))
dashboard_response
=
self
.
client
.
get
(
reverse
(
'dashboard'
))
...
...
common/djangoapps/third_party_auth/tests/specs/test_lti.py
View file @
40448e44
...
@@ -29,6 +29,8 @@ class IntegrationTestLTI(testutil.TestCase):
...
@@ -29,6 +29,8 @@ class IntegrationTestLTI(testutil.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
super
(
IntegrationTestLTI
,
self
)
.
setUp
()
super
(
IntegrationTestLTI
,
self
)
.
setUp
()
self
.
client
.
defaults
[
'SERVER_NAME'
]
=
'testserver'
self
.
url_prefix
=
'http://testserver'
self
.
configure_lti_provider
(
self
.
configure_lti_provider
(
name
=
'Other Tool Consumer 1'
,
enabled
=
True
,
name
=
'Other Tool Consumer 1'
,
enabled
=
True
,
lti_consumer_key
=
'other1'
,
lti_consumer_key
=
'other1'
,
...
...
common/djangoapps/third_party_auth/tests/testutil.py
View file @
40448e44
...
@@ -155,7 +155,12 @@ class ThirdPartyAuthTestMixin(object):
...
@@ -155,7 +155,12 @@ class ThirdPartyAuthTestMixin(object):
class
TestCase
(
ThirdPartyAuthTestMixin
,
django
.
test
.
TestCase
):
class
TestCase
(
ThirdPartyAuthTestMixin
,
django
.
test
.
TestCase
):
"""Base class for auth test cases."""
"""Base class for auth test cases."""
pass
def
setUp
(
self
):
super
(
TestCase
,
self
)
.
setUp
()
# Explicitly set a server name that is compatible with all our providers:
# (The SAML lib we use doesn't like the default 'testserver' as a domain)
self
.
client
.
defaults
[
'SERVER_NAME'
]
=
'example.none'
self
.
url_prefix
=
'http://example.none'
class
SAMLTestCase
(
TestCase
):
class
SAMLTestCase
(
TestCase
):
...
...
common/djangoapps/third_party_auth/urls.py
View file @
40448e44
...
@@ -6,7 +6,7 @@ from .views import inactive_user_view, saml_metadata_view, lti_login_and_complet
...
@@ -6,7 +6,7 @@ from .views import inactive_user_view, saml_metadata_view, lti_login_and_complet
urlpatterns
=
patterns
(
urlpatterns
=
patterns
(
''
,
''
,
url
(
r'^auth/inactive'
,
inactive_user_view
),
url
(
r'^auth/inactive'
,
inactive_user_view
,
name
=
"third_party_inactive_redirect"
),
url
(
r'^auth/saml/metadata.xml'
,
saml_metadata_view
),
url
(
r'^auth/saml/metadata.xml'
,
saml_metadata_view
),
url
(
r'^auth/login/(?P<backend>lti)/$'
,
lti_login_and_complete_view
),
url
(
r'^auth/login/(?P<backend>lti)/$'
,
lti_login_and_complete_view
),
url
(
r'^auth/'
,
include
(
'social.apps.django_app.urls'
,
namespace
=
'social'
)),
url
(
r'^auth/'
,
include
(
'social.apps.django_app.urls'
,
namespace
=
'social'
)),
...
...
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