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
62fcc6f2
Commit
62fcc6f2
authored
Sep 05, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ddt for shib tests
parent
4e796c57
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
common/djangoapps/external_auth/tests/test_shib.py
+8
-6
No files found.
common/djangoapps/external_auth/tests/test_shib.py
View file @
62fcc6f2
...
@@ -5,6 +5,7 @@ Tests for Shibboleth Authentication
...
@@ -5,6 +5,7 @@ Tests for Shibboleth Authentication
"""
"""
import
unittest
import
unittest
from
mock
import
patch
from
mock
import
patch
from
ddt
import
ddt
,
data
from
django.conf
import
settings
from
django.conf
import
settings
from
django.http
import
HttpResponseRedirect
from
django.http
import
HttpResponseRedirect
...
@@ -74,6 +75,7 @@ def gen_all_identities():
...
@@ -74,6 +75,7 @@ def gen_all_identities():
yield
_build_identity_dict
(
mail
,
display_name
,
given_name
,
surname
)
yield
_build_identity_dict
(
mail
,
display_name
,
given_name
,
surname
)
@ddt
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
,
SESSION_ENGINE
=
'django.contrib.sessions.backends.cache'
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
,
SESSION_ENGINE
=
'django.contrib.sessions.backends.cache'
)
class
ShibSPTest
(
ModuleStoreTestCase
):
class
ShibSPTest
(
ModuleStoreTestCase
):
"""
"""
...
@@ -271,13 +273,13 @@ class ShibSPTest(ModuleStoreTestCase):
...
@@ -271,13 +273,13 @@ class ShibSPTest(ModuleStoreTestCase):
self
.
_base_test_extauth_auto_activate_user_with_flag
(
log_user_string
=
"user.id: 1"
)
self
.
_base_test_extauth_auto_activate_user_with_flag
(
log_user_string
=
"user.id: 1"
)
@unittest.skipUnless
(
settings
.
FEATURES
.
get
(
'AUTH_USE_SHIB'
),
"AUTH_USE_SHIB not set"
)
@unittest.skipUnless
(
settings
.
FEATURES
.
get
(
'AUTH_USE_SHIB'
),
"AUTH_USE_SHIB not set"
)
def
test_registration_form
(
self
):
@data
(
*
gen_all_identities
())
def
test_registration_form
(
self
,
identity
):
"""
"""
Tests the registration form showing up with the proper parameters.
Tests the registration form showing up with the proper parameters.
Uses django test client for its session support
Uses django test client for its session support
"""
"""
for
identity
in
gen_all_identities
():
client
=
DjangoTestClient
()
client
=
DjangoTestClient
()
# identity k/v pairs will show up in request.META
# identity k/v pairs will show up in request.META
response
=
client
.
get
(
path
=
'/shib-login/'
,
data
=
{},
follow
=
False
,
**
identity
)
response
=
client
.
get
(
path
=
'/shib-login/'
,
data
=
{},
follow
=
False
,
**
identity
)
...
@@ -301,7 +303,8 @@ class ShibSPTest(ModuleStoreTestCase):
...
@@ -301,7 +303,8 @@ class ShibSPTest(ModuleStoreTestCase):
client
.
session
[
'ExternalAuthMap'
]
.
delete
()
client
.
session
[
'ExternalAuthMap'
]
.
delete
()
@unittest.skipUnless
(
settings
.
FEATURES
.
get
(
'AUTH_USE_SHIB'
),
"AUTH_USE_SHIB not set"
)
@unittest.skipUnless
(
settings
.
FEATURES
.
get
(
'AUTH_USE_SHIB'
),
"AUTH_USE_SHIB not set"
)
def
test_registration_form_submit
(
self
):
@data
(
*
gen_all_identities
())
def
test_registration_form_submit
(
self
,
identity
):
"""
"""
Tests user creation after the registration form that pops is submitted. If there is no shib
Tests user creation after the registration form that pops is submitted. If there is no shib
ExternalAuthMap in the session, then the created user should take the username and email from the
ExternalAuthMap in the session, then the created user should take the username and email from the
...
@@ -309,7 +312,6 @@ class ShibSPTest(ModuleStoreTestCase):
...
@@ -309,7 +312,6 @@ class ShibSPTest(ModuleStoreTestCase):
Uses django test client for its session support
Uses django test client for its session support
"""
"""
for
identity
in
gen_all_identities
():
# First we pop the registration form
# First we pop the registration form
client
=
DjangoTestClient
()
client
=
DjangoTestClient
()
response1
=
client
.
get
(
path
=
'/shib-login/'
,
data
=
{},
follow
=
False
,
**
identity
)
response1
=
client
.
get
(
path
=
'/shib-login/'
,
data
=
{},
follow
=
False
,
**
identity
)
...
@@ -386,7 +388,8 @@ class ShibSPTest(ModuleStoreTestCase):
...
@@ -386,7 +388,8 @@ class ShibSPTest(ModuleStoreTestCase):
user
.
delete
()
user
.
delete
()
@unittest.skipUnless
(
settings
.
FEATURES
.
get
(
'AUTH_USE_SHIB'
),
"AUTH_USE_SHIB not set"
)
@unittest.skipUnless
(
settings
.
FEATURES
.
get
(
'AUTH_USE_SHIB'
),
"AUTH_USE_SHIB not set"
)
def
test_course_specific_login_and_reg
(
self
):
@data
(
""
,
"shib:https://idp.stanford.edu/"
)
def
test_course_specific_login_and_reg
(
self
,
domain
):
"""
"""
Tests that the correct course specific login and registration urls work for shib
Tests that the correct course specific login and registration urls work for shib
"""
"""
...
@@ -398,7 +401,6 @@ class ShibSPTest(ModuleStoreTestCase):
...
@@ -398,7 +401,6 @@ class ShibSPTest(ModuleStoreTestCase):
)
)
# Test for cases where course is found
# Test for cases where course is found
for
domain
in
[
""
,
"shib:https://idp.stanford.edu/"
]:
# set domains
# set domains
# temporarily set the branch to draft-preferred so we can update the course
# temporarily set the branch to draft-preferred so we can update the course
...
...
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