From ed6e46453c665c7a71d0eba41981c94ebc2867bb Mon Sep 17 00:00:00 2001 From: Afeef Janjua <janjua.afeef@gmail.com> Date: Wed, 4 Nov 2015 18:55:57 +0500 Subject: [PATCH] allow reverification for pending status ('must_retry', 'submitted') --- AUTHORS | 1 + lms/djangoapps/verify_student/tests/test_views.py | 14 +++++++++++--- lms/djangoapps/verify_student/views.py | 6 +++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index 28ee38920cd..c04dc2c40ed 100644 --- a/AUTHORS +++ b/AUTHORS @@ -255,3 +255,4 @@ Douglas Hall <dhall@edx.org> Awais Jibran <awaisdar001@gmail.com> Muhammad Rehan <muhammadrehan69@gmail.com> Shawn Milochik <shawn@milochik.com> +Afeef Janjua <janjua.afeef@gmail.com> diff --git a/lms/djangoapps/verify_student/tests/test_views.py b/lms/djangoapps/verify_student/tests/test_views.py index 82127df3ce4..588690dd743 100644 --- a/lms/djangoapps/verify_student/tests/test_views.py +++ b/lms/djangoapps/verify_student/tests/test_views.py @@ -1870,14 +1870,22 @@ class TestReverifyView(TestCase): # Allow the student to reverify self._assert_can_reverify() - def test_reverify_view_cannot_reverify_pending(self): + def test_reverify_view_can_reverify_pending(self): + """ Test that the user can still re-verify even if the previous photo + verification is in pending state. + + A photo verification is considered in pending state when the user has + either submitted the photo verification (status in database: 'submitted') + or photo verification submission failed (status in database: 'must_retry'). + """ + # User has submitted a verification attempt, but Software Secure has not yet responded attempt = SoftwareSecurePhotoVerification.objects.create(user=self.user) attempt.mark_ready() attempt.submit() - # Cannot reverify because an attempt has already been submitted. - self._assert_cannot_reverify() + # Can re-verify because an attempt has already been submitted. + self._assert_can_reverify() def test_reverify_view_cannot_reverify_approved(self): # Submitted attempt has been approved diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py index 27109443652..46d831d5239 100644 --- a/lms/djangoapps/verify_student/views.py +++ b/lms/djangoapps/verify_student/views.py @@ -1350,7 +1350,11 @@ class ReverifyView(View): Backbone views used in the initial verification flow. """ status, _ = SoftwareSecurePhotoVerification.user_status(request.user) - if status in ["must_reverify", "expired"]: + + # If the verification process is still ongoing i.e. the status for photo + # verification is either 'submitted' or 'must_retry' then its marked as + # 'pending' + if status in ["must_reverify", "expired", "pending"]: context = { "user_full_name": request.user.profile.name, "platform_name": settings.PLATFORM_NAME, -- GitLab