Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added photo_id_key while AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING is True #10393

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lms/djangoapps/verify_student/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,9 @@ def upload_photo_id_image(self, img_data):
# 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()
Expand Down
17 changes: 17 additions & 0 deletions lms/djangoapps/verify_student/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from datetime import timedelta, datetime
import ddt
import json
import mock
import requests.exceptions
import pytz

Expand Down Expand Up @@ -236,6 +237,22 @@ def test_submissions(self):
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
Expand Down