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
df638088
Commit
df638088
authored
Dec 07, 2015
by
Christine Lytwynec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pr fixes
parent
9f5273a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
common/djangoapps/student/tests/test_auto_auth.py
+13
-5
No files found.
common/djangoapps/student/tests/test_auto_auth.py
View file @
df638088
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.test.client
import
Client
from
django.test.client
import
Client
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.conf
import
settings
from
django_comment_common.models
import
(
from
django_comment_common.models
import
(
Role
,
FORUM_ROLE_ADMINISTRATOR
,
FORUM_ROLE_MODERATOR
,
FORUM_ROLE_STUDENT
)
Role
,
FORUM_ROLE_ADMINISTRATOR
,
FORUM_ROLE_MODERATOR
,
FORUM_ROLE_STUDENT
)
from
django_comment_common.utils
import
seed_permissions_roles
from
django_comment_common.utils
import
seed_permissions_roles
...
@@ -178,7 +179,6 @@ class AutoAuthEnabledTestCase(UrlResetMixin, TestCase):
...
@@ -178,7 +179,6 @@ class AutoAuthEnabledTestCase(UrlResetMixin, TestCase):
@ddt.data
(
*
COURSE_IDS_DDT
)
@ddt.data
(
*
COURSE_IDS_DDT
)
@ddt.unpack
@ddt.unpack
def
test_redirect_to_course
(
self
,
course_id
,
course_key
):
def
test_redirect_to_course
(
self
,
course_id
,
course_key
):
# Create a user and enroll in a course
# Create a user and enroll in a course
response
=
self
.
_auto_auth
({
response
=
self
.
_auto_auth
({
'username'
:
'test'
,
'username'
:
'test'
,
...
@@ -193,8 +193,12 @@ class AutoAuthEnabledTestCase(UrlResetMixin, TestCase):
...
@@ -193,8 +193,12 @@ class AutoAuthEnabledTestCase(UrlResetMixin, TestCase):
self
.
assertEqual
(
enrollment
.
user
.
username
,
"test"
)
self
.
assertEqual
(
enrollment
.
user
.
username
,
"test"
)
# Check that the redirect was to the course info/outline page
# Check that the redirect was to the course info/outline page
urls
=
(
'/info'
,
'course/{}'
.
format
(
course_key
.
to_deprecated_string
()))
if
settings
.
ROOT_URLCONF
==
'lms.urls'
:
self
.
assertTrue
(
response
.
url
.
endswith
(
urls
))
# pylint: disable=no-member
url_pattern
=
'/info'
else
:
url_pattern
=
'/course/{}'
.
format
(
unicode
(
course_key
))
self
.
assertTrue
(
response
.
url
.
endswith
(
url_pattern
))
# pylint: disable=no-member
def
test_redirect_to_main
(
self
):
def
test_redirect_to_main
(
self
):
# Create user and redirect to 'home' (cms) or 'dashboard' (lms)
# Create user and redirect to 'home' (cms) or 'dashboard' (lms)
...
@@ -205,8 +209,12 @@ class AutoAuthEnabledTestCase(UrlResetMixin, TestCase):
...
@@ -205,8 +209,12 @@ class AutoAuthEnabledTestCase(UrlResetMixin, TestCase):
},
status_code
=
302
)
},
status_code
=
302
)
# Check that the redirect was to either /dashboard or /home
# Check that the redirect was to either /dashboard or /home
urls
=
(
'/dashboard'
,
'/home'
)
if
settings
.
ROOT_URLCONF
==
'lms.urls'
:
self
.
assertTrue
(
response
.
url
.
endswith
(
urls
))
# pylint: disable=no-member
url_pattern
=
'/dashboard'
else
:
url_pattern
=
'/home'
self
.
assertTrue
(
response
.
url
.
endswith
(
url_pattern
))
# pylint: disable=no-member
def
_auto_auth
(
self
,
params
=
None
,
status_code
=
None
,
**
kwargs
):
def
_auto_auth
(
self
,
params
=
None
,
status_code
=
None
,
**
kwargs
):
"""
"""
...
...
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