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
40a03ebb
Commit
40a03ebb
authored
May 07, 2014
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redirected to dashboard if course mode is none.
LMS-2617
parent
2d132e10
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
lms/djangoapps/verify_student/tests/test_views.py
+28
-0
lms/djangoapps/verify_student/views.py
+2
-0
No files found.
lms/djangoapps/verify_student/tests/test_views.py
View file @
40a03ebb
...
...
@@ -81,6 +81,34 @@ class TestVerifyView(TestCase):
@override_settings
(
MODULESTORE
=
TEST_DATA_MONGO_MODULESTORE
)
class
TestVerifiedView
(
TestCase
):
"""
Tests for VerifiedView.
"""
def
setUp
(
self
):
self
.
user
=
UserFactory
.
create
(
username
=
"abc"
,
password
=
"test"
)
self
.
client
.
login
(
username
=
"abc"
,
password
=
"test"
)
self
.
course_id
=
"MITx/999.1x/Verified_Course"
self
.
course
=
CourseFactory
.
create
(
org
=
'MITx'
,
number
=
'999.1x'
,
display_name
=
'Verified Course'
)
def
test_verified_course_mode_none
(
self
):
"""
Test VerifiedView when there is no active verified mode for course.
"""
url
=
reverse
(
'verify_student_verified'
,
kwargs
=
{
"course_id"
:
self
.
course_id
})
verify_mode
=
CourseMode
.
mode_for_course
(
self
.
course_id
,
"verified"
)
# Verify mode should be None.
self
.
assertEquals
(
verify_mode
,
None
)
response
=
self
.
client
.
get
(
url
)
# Status code should be 302.
self
.
assertTrue
(
response
.
status_code
,
302
)
# Location should contains dashboard.
self
.
assertIn
(
'dashboard'
,
response
.
_headers
.
get
(
'location'
)[
1
])
@override_settings
(
MODULESTORE
=
TEST_DATA_MONGO_MODULESTORE
)
class
TestReverifyView
(
TestCase
):
"""
Tests for the reverification views
...
...
lms/djangoapps/verify_student/views.py
View file @
40a03ebb
...
...
@@ -117,6 +117,8 @@ class VerifiedView(View):
if
CourseEnrollment
.
enrollment_mode_for_user
(
request
.
user
,
course_id
)
==
'verified'
:
return
redirect
(
reverse
(
'dashboard'
))
verify_mode
=
CourseMode
.
mode_for_course
(
course_id
,
"verified"
)
if
verify_mode
is
None
:
return
redirect
(
reverse
(
'dashboard'
))
if
course_id
in
request
.
session
.
get
(
"donation_for_course"
,
{}):
chosen_price
=
request
.
session
[
"donation_for_course"
][
course_id
]
else
:
...
...
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