From a1a58db9be8c01370f416d388c423e4b50fddc3d Mon Sep 17 00:00:00 2001 From: Bill DeRusha Date: Tue, 23 Feb 2016 09:45:54 -0500 Subject: [PATCH] Do not send initial verification photo_id if new photo_id provided ECOM-2888 --- lms/djangoapps/verify_student/tests/test_views.py | 13 ++++++++++++- lms/djangoapps/verify_student/views.py | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/verify_student/tests/test_views.py b/lms/djangoapps/verify_student/tests/test_views.py index 4852334528..2a876035ed 100644 --- a/lms/djangoapps/verify_student/tests/test_views.py +++ b/lms/djangoapps/verify_student/tests/test_views.py @@ -1427,7 +1427,8 @@ class TestSubmitPhotosForVerification(TestCase): "AWS_ACCESS_KEY": "c987c7efe35c403caa821f7328febfa1", "AWS_SECRET_KEY": "fc595fc657c04437bb23495d8fe64881", "S3_BUCKET": "test.example.com", - } + }, + "DAYS_GOOD_FOR": 10, }) @httpretty.activate @moto.mock_s3 @@ -1470,6 +1471,16 @@ class TestSubmitPhotosForVerification(TestCase): self.assertNotEqual(initial_photo_response.content, reverification_photo_response.content) + # Submit a new face photo and photo id for verification + self._submit_photos( + face_image=self.IMAGE_DATA + "9999", + photo_id_image=self.IMAGE_DATA + "1111", + ) + two_photo_reverification_data = self._get_post_data() + + # Verify that the initial attempt sent a new ID photo for the reverification attempt + self.assertNotEqual(initial_data["PhotoIDKey"], two_photo_reverification_data["PhotoIDKey"]) + @ddt.data('face_image', 'photo_id_image') def test_invalid_image_data(self, invalid_param): params = { diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py index 431ba89b97..81aa0c2487 100644 --- a/lms/djangoapps/verify_student/views.py +++ b/lms/djangoapps/verify_student/views.py @@ -872,6 +872,11 @@ class SubmitPhotosView(View): face_image, photo_id_image, response = self._decode_image_data( params["face_image"], params.get("photo_id_image") ) + + # If we have a photo_id we do not want use the initial verification image. + if photo_id_image is not None: + initial_verification = None + if response is not None: return response