Merge pull request #10393 from edx/tasawer/story/ecom-2547-set-photo-id-for-initial-verfication
Added photo_id_key while AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING is True
This commit is contained in:
@@ -647,6 +647,9 @@ class SoftwareSecurePhotoVerification(PhotoVerification):
|
||||
# verification functionality. If you do want to work on it, you have to
|
||||
# explicitly enable these in your private settings.
|
||||
if settings.FEATURES.get('AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'):
|
||||
# fake photo id key is set only for initial verification
|
||||
self.photo_id_key = 'fake-photo-id-key'
|
||||
self.save()
|
||||
return
|
||||
|
||||
aes_key = random_aes_key()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
from datetime import timedelta, datetime
|
||||
import ddt
|
||||
import json
|
||||
import mock
|
||||
import requests.exceptions
|
||||
import pytz
|
||||
|
||||
@@ -236,6 +237,22 @@ class TestPhotoVerification(ModuleStoreTestCase):
|
||||
attempt = self.create_and_submit()
|
||||
assert_equals(attempt.status, "must_retry")
|
||||
|
||||
@mock.patch.dict(settings.FEATURES, {'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING': True})
|
||||
def test_submission_while_testing_flag_is_true(self):
|
||||
""" Test that a fake value is set for field 'photo_id_key' of user's
|
||||
initial verification when the feature flag 'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
|
||||
is enabled.
|
||||
"""
|
||||
user = UserFactory.create()
|
||||
attempt = SoftwareSecurePhotoVerification(user=user)
|
||||
user.profile.name = "test-user"
|
||||
|
||||
attempt.upload_photo_id_image("Image data")
|
||||
attempt.mark_ready()
|
||||
attempt.submit()
|
||||
|
||||
self.assertEqual(attempt.photo_id_key, "fake-photo-id-key")
|
||||
|
||||
def test_active_for_user(self):
|
||||
"""
|
||||
Make sure we can retrive a user's active (in progress) verification
|
||||
|
||||
Reference in New Issue
Block a user