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
ec5e767b
Commit
ec5e767b
authored
Sep 19, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If the current course doesn't have a verified course mode
kick the user out of the verify registration flow.
parent
29710661
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
lms/djangoapps/verify_student/tests/test_views.py
+24
-0
lms/djangoapps/verify_student/views.py
+4
-0
No files found.
lms/djangoapps/verify_student/tests/test_views.py
View file @
ec5e767b
...
...
@@ -13,9 +13,12 @@ import urllib
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
django.core.urlresolvers
import
reverse
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
courseware.tests.tests
import
TEST_DATA_MONGO_MODULESTORE
from
student.tests.factories
import
UserFactory
from
course_modes.models
import
CourseMode
class
StartView
(
TestCase
):
...
...
@@ -34,3 +37,24 @@ class StartView(TestCase):
def
must_be_logged_in
(
self
):
self
.
assertHttpForbidden
(
self
.
client
.
get
(
self
.
start_url
()))
@override_settings
(
MODULESTORE
=
TEST_DATA_MONGO_MODULESTORE
)
class
TestVerifyView
(
TestCase
):
def
setUp
(
self
):
self
.
user
=
UserFactory
.
create
(
username
=
"rusty"
,
password
=
"test"
)
self
.
client
.
login
(
username
=
"rusty"
,
password
=
"test"
)
self
.
course_id
=
'Robot/999/Test_Course'
CourseFactory
.
create
(
org
=
'Robot'
,
number
=
'999'
,
display_name
=
'Test Course'
)
verified_mode
=
CourseMode
(
course_id
=
self
.
course_id
,
mode_slug
=
"verified"
,
mode_display_name
=
"Verified Certificate"
,
min_price
=
50
)
verified_mode
.
save
()
def
test_invalid_course
(
self
):
fake_course_id
=
"Robot/999/Fake_Course"
url
=
reverse
(
'verify_student_verify'
,
kwargs
=
{
"course_id"
:
fake_course_id
})
response
=
self
.
client
.
get
(
url
)
self
.
assertEquals
(
response
.
status_code
,
302
)
lms/djangoapps/verify_student/views.py
View file @
ec5e767b
...
...
@@ -54,6 +54,10 @@ class VerifyView(View):
progress_state
=
"start"
verify_mode
=
CourseMode
.
mode_for_course
(
course_id
,
"verified"
)
# if the course doesn't have a verified mode, we want to kick them
# from the flow
if
not
verify_mode
:
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