Commit ec5e767b by Diana Huang

If the current course doesn't have a verified course mode

kick the user out of the verify registration flow.
parent 29710661
......@@ -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)
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment