Enter the new verification / payment flow using a GET param

Allow disabling of experiment
This commit is contained in:
Will Daly
2014-12-29 16:33:42 -08:00
parent 234691e446
commit a90f7ab1bf
10 changed files with 92 additions and 29 deletions

View File

@@ -55,6 +55,16 @@ class ChooseModeView(View):
upgrade = request.GET.get('upgrade', False)
request.session['attempting_upgrade'] = upgrade
# TODO (ECOM-188): Once the A/B test of decoupled/verified flows
# completes, we can remove this flag.
# The A/B test framework will reload the page with the ?separate-verified GET param
# set if the user is in the experimental condition. We then store this flag
# in a session variable so downstream views can check it.
if request.GET.get('separate-verified', False):
request.session['separate-verified'] = True
elif request.GET.get('disable-separate-verified', False) and 'separate-verified' in request.session:
del request.session['separate-verified']
enrollment_mode, is_active = CourseEnrollment.enrollment_mode_for_user(request.user, course_key)
modes = CourseMode.modes_for_course_dict(course_key)
@@ -63,7 +73,9 @@ class ChooseModeView(View):
# to the usual "choose your track" page.
has_enrolled_professional = (enrollment_mode == "professional" and is_active)
if "professional" in modes and not has_enrolled_professional:
if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT'):
# TODO (ECOM-188): Once the A/B test of separating verification / payment completes,
# we can remove the check for the session variable.
if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT') and request.session.get('separate-verified', False):
return redirect(
reverse(
'verify_student_start_flow',
@@ -180,7 +192,9 @@ class ChooseModeView(View):
donation_for_course[unicode(course_key)] = amount_value
request.session["donation_for_course"] = donation_for_course
if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT'):
# TODO (ECOM-188): Once the A/B test of separate verification flow completes,
# we can remove the check for the session variable.
if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT') and request.session.get('separate-verified', False):
return redirect(
reverse(
'verify_student_start_flow',

View File

@@ -50,6 +50,12 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
success = self.client.login(username=self.user.username, password="edx")
self.assertTrue(success, msg="Did not log in successfully")
# Use the URL with the querystring param to put the user
# in the experimental track.
# TODO (ECOM-188): Once the A/B test of decoupling verified / payment
# completes, we can remove the querystring param.
self.dashboard_url = reverse('dashboard') + '?separate-verified=1'
def test_enrolled_as_non_verified(self):
self._setup_mode_and_enrollment(None, "honor")
@@ -92,7 +98,7 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
def test_need_to_verify_expiration(self):
self._setup_mode_and_enrollment(self.FUTURE, "verified")
response = self.client.get(reverse('dashboard'))
response = self.client.get(self.dashboard_url)
self.assertContains(response, self.BANNER_ALT_MESSAGES[VERIFY_STATUS_NEED_TO_VERIFY])
self.assertContains(response, "You only have 4 days left to verify for this course.")
@@ -122,7 +128,7 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
self._assert_course_verification_status(VERIFY_STATUS_APPROVED)
# Check that the "verification good until" date is displayed
response = self.client.get(reverse('dashboard'))
response = self.client.get(self.dashboard_url)
self.assertContains(response, attempt.expiration_datetime.strftime("%m/%d/%Y"))
def test_missed_verification_deadline(self):
@@ -237,7 +243,7 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
AssertionError
"""
response = self.client.get(reverse('dashboard'))
response = self.client.get(self.dashboard_url)
# Sanity check: verify that the course is on the page
self.assertContains(response, unicode(self.course.id))

View File

@@ -568,13 +568,21 @@ def dashboard(request):
#
# If a course is not included in this dictionary,
# there is no verification messaging to display.
if settings.FEATURES.get("SEPARATE_VERIFICATION_FROM_PAYMENT"):
#
# TODO (ECOM-188): After the A/B test completes, we can remove the check
# for the GET param and the session var.
# The A/B test framework will set the GET param for users in the experimental
# group; we then set the session var so downstream views can check this.
if settings.FEATURES.get("SEPARATE_VERIFICATION_FROM_PAYMENT") and request.GET.get('separate-verified', False):
request.session['separate-verified'] = True
verify_status_by_course = check_verify_status_by_course(
user,
course_enrollment_pairs,
all_course_modes
)
else:
if request.GET.get('disable-separate-verified', False) and 'separate-verified' in request.session:
del request.session['separate-verified']
verify_status_by_course = {}
cert_statuses = {