Merge pull request #29820 from openedx/bseverino/remove-idv-experiment
[MST-869] Remove code related to IDV experiment
This commit is contained in:
@@ -1232,9 +1232,6 @@ class TestSubmitPhotosForVerification(MockS3BotoMixin, TestVerificationBase):
|
||||
PASSWORD = "test_password"
|
||||
IMAGE_DATA = "data:image/png;base64,1234"
|
||||
FULL_NAME = "Ḟüḷḷ Ṅäṁë"
|
||||
EXPERIMENT_NAME = "test-experiment"
|
||||
PORTRAIT_PHOTO_MODE = "upload"
|
||||
ID_PHOTO_MODE = "camera"
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
@@ -1387,39 +1384,9 @@ class TestSubmitPhotosForVerification(MockS3BotoMixin, TestVerificationBase):
|
||||
# Now the request should succeed
|
||||
self._submit_photos(face_image=self.IMAGE_DATA)
|
||||
|
||||
@patch('lms.djangoapps.verify_student.views.segment.track')
|
||||
def test_experiment_params(self, mock_segment_track):
|
||||
# Submit the photos
|
||||
self._submit_photos(
|
||||
face_image=self.IMAGE_DATA,
|
||||
photo_id_image=self.IMAGE_DATA,
|
||||
experiment_name=self.EXPERIMENT_NAME,
|
||||
portrait_photo_mode=self.PORTRAIT_PHOTO_MODE,
|
||||
id_photo_mode=self.ID_PHOTO_MODE
|
||||
)
|
||||
|
||||
# Verify that the attempt is created in the database
|
||||
attempt = SoftwareSecurePhotoVerification.objects.get(user=self.user)
|
||||
assert attempt.status == 'submitted'
|
||||
|
||||
# assert that segment tracking has been called with experiment name
|
||||
experiment_data = {
|
||||
"attempt_id": attempt.id,
|
||||
"experiment_name": self.EXPERIMENT_NAME
|
||||
}
|
||||
mock_segment_track.assert_any_call(self.user.id, "edx.bi.experiment.verification.attempt", experiment_data)
|
||||
|
||||
mode_data = {
|
||||
"attempt_id": attempt.id,
|
||||
"portrait_photo_mode": self.PORTRAIT_PHOTO_MODE,
|
||||
"id_photo_mode": self.ID_PHOTO_MODE
|
||||
}
|
||||
mock_segment_track.assert_any_call(self.user.id, "edx.bi.experiment.verification.attempt.photo.mode", mode_data)
|
||||
|
||||
def _submit_photos(
|
||||
self, face_image=None, photo_id_image=None,
|
||||
full_name=None, experiment_name=None,
|
||||
portrait_photo_mode=None, id_photo_mode=None, expected_status_code=200
|
||||
full_name=None, expected_status_code=200
|
||||
):
|
||||
"""Submit photos for verification.
|
||||
|
||||
@@ -1427,7 +1394,6 @@ class TestSubmitPhotosForVerification(MockS3BotoMixin, TestVerificationBase):
|
||||
face_image (str): The base-64 encoded face image data.
|
||||
photo_id_image (str): The base-64 encoded ID image data.
|
||||
full_name (unicode): The full name of the user, if the user is changing it.
|
||||
experiment_name (str): Name of A/B experiment associated with attempt
|
||||
expected_status_code (int): The expected response status code.
|
||||
|
||||
Returns:
|
||||
@@ -1446,15 +1412,6 @@ class TestSubmitPhotosForVerification(MockS3BotoMixin, TestVerificationBase):
|
||||
if full_name is not None:
|
||||
params['full_name'] = full_name
|
||||
|
||||
if experiment_name is not None:
|
||||
params['experiment_name'] = experiment_name
|
||||
|
||||
if portrait_photo_mode is not None:
|
||||
params['portrait_photo_mode'] = portrait_photo_mode
|
||||
|
||||
if id_photo_mode is not None:
|
||||
params['id_photo_mode'] = id_photo_mode
|
||||
|
||||
with self.immediate_on_commit():
|
||||
response = self.client.post(url, params)
|
||||
assert response.status_code == expected_status_code
|
||||
@@ -1653,13 +1610,6 @@ class TestPhotoVerificationResultsCallback(ModuleStoreTestCase, TestVerification
|
||||
assert response.content.decode('utf-8') == 'OK!'
|
||||
self._assert_verification_approved_email(expiration_datetime.date())
|
||||
|
||||
# assert that segment tracking has been called with result
|
||||
data = {
|
||||
"attempt_id": attempt.id,
|
||||
"result": "PASS"
|
||||
}
|
||||
mock_segment_track.assert_called_with(attempt.user.id, "edx.bi.experiment.verification.attempt.result", data)
|
||||
|
||||
@patch.dict(settings.VERIFY_STUDENT, {'USE_DJANGO_MAIL': True})
|
||||
def test_approved_email_without_ace(self):
|
||||
"""
|
||||
@@ -1719,13 +1669,6 @@ class TestPhotoVerificationResultsCallback(ModuleStoreTestCase, TestVerification
|
||||
assert response.content.decode('utf-8') == 'OK!'
|
||||
self._assert_verification_approved_email(expiration_datetime.date())
|
||||
|
||||
# assert that segment tracking has been called with result
|
||||
data = {
|
||||
"attempt_id": attempt.id,
|
||||
"result": "PASS"
|
||||
}
|
||||
mock_segment_track.assert_called_with(attempt.user.id, "edx.bi.experiment.verification.attempt.result", data)
|
||||
|
||||
@patch(
|
||||
'lms.djangoapps.verify_student.ssencrypt.has_valid_signature',
|
||||
mock.Mock(side_effect=mocked_has_valid_signature)
|
||||
@@ -1757,13 +1700,6 @@ class TestPhotoVerificationResultsCallback(ModuleStoreTestCase, TestVerification
|
||||
assert response.content.decode('utf-8') == 'OK!'
|
||||
self._assert_verification_denied_email()
|
||||
|
||||
# assert that segment tracking has been called with result
|
||||
data = {
|
||||
"attempt_id": attempt.id,
|
||||
"result": "FAIL"
|
||||
}
|
||||
mock_segment_track.assert_called_with(attempt.user.id, "edx.bi.experiment.verification.attempt.result", data)
|
||||
|
||||
@patch(
|
||||
'lms.djangoapps.verify_student.ssencrypt.has_valid_signature',
|
||||
mock.Mock(side_effect=mocked_has_valid_signature)
|
||||
@@ -1791,13 +1727,6 @@ class TestPhotoVerificationResultsCallback(ModuleStoreTestCase, TestVerification
|
||||
assert attempt.error_msg == '"Memory overflow"'
|
||||
assert response.content.decode('utf-8') == 'OK!'
|
||||
|
||||
# assert that segment tracking has been called with result
|
||||
data = {
|
||||
"attempt_id": attempt.id,
|
||||
"result": "SYSTEM FAIL"
|
||||
}
|
||||
mock_segment_track.assert_called_with(attempt.user.id, "edx.bi.experiment.verification.attempt.result", data)
|
||||
|
||||
@patch(
|
||||
'lms.djangoapps.verify_student.ssencrypt.has_valid_signature',
|
||||
mock.Mock(side_effect=mocked_has_valid_signature)
|
||||
|
||||
@@ -828,9 +828,6 @@ class SubmitPhotosView(View):
|
||||
face_image (str): base64-encoded image data of the user's face.
|
||||
photo_id_image (str): base64-encoded image data of the user's photo ID.
|
||||
full_name (str): The user's full name, if the user is requesting a name change as well.
|
||||
experiment_name (str): The name of an A/B experiment associated with this attempt
|
||||
portrait_photo_mode (str): The mode in which the portrait photo was taken
|
||||
id_photo_mode (str): The mode in which the id photo was taken
|
||||
|
||||
"""
|
||||
# If the user already has an initial verification attempt, we can re-use the photo ID
|
||||
@@ -861,22 +858,7 @@ class SubmitPhotosView(View):
|
||||
return response
|
||||
|
||||
# Submit the attempt
|
||||
attempt = self._submit_attempt(request.user, face_image, photo_id_image, initial_verification, full_name)
|
||||
|
||||
# Send event to segment for analyzing A/B testing data
|
||||
data = {
|
||||
"attempt_id": attempt.id,
|
||||
"experiment_name": params.get("experiment_name", "original")
|
||||
}
|
||||
self._fire_event(request.user, "edx.bi.experiment.verification.attempt", data)
|
||||
|
||||
if params.get("portrait_photo_mode"):
|
||||
mode_data = {
|
||||
"attempt_id": attempt.id,
|
||||
"portrait_photo_mode": params.get("portrait_photo_mode"),
|
||||
"id_photo_mode": params.get("id_photo_mode")
|
||||
}
|
||||
self._fire_event(request.user, "edx.bi.experiment.verification.attempt.photo.mode", mode_data)
|
||||
self._submit_attempt(request.user, face_image, photo_id_image, initial_verification, full_name)
|
||||
|
||||
self._fire_event(request.user, "edx.bi.verify.submitted", {"category": "verification"})
|
||||
self._send_confirmation_email(request.user)
|
||||
@@ -901,9 +883,6 @@ class SubmitPhotosView(View):
|
||||
"face_image",
|
||||
"photo_id_image",
|
||||
"full_name",
|
||||
"experiment_name",
|
||||
"portrait_photo_mode",
|
||||
"id_photo_mode"
|
||||
]
|
||||
if param_name in request.POST
|
||||
}
|
||||
@@ -1162,13 +1141,6 @@ def results_callback(request): # lint-amnesty, pylint: disable=too-many-stateme
|
||||
f"Result {result} not understood. Known results: PASS, FAIL, SYSTEM FAIL"
|
||||
)
|
||||
|
||||
# Send event to segment for analyzing A/B testing data
|
||||
data = {
|
||||
"attempt_id": attempt.id,
|
||||
"result": result
|
||||
}
|
||||
segment.track(attempt.user.id, "edx.bi.experiment.verification.attempt.result", data)
|
||||
|
||||
return HttpResponse("OK!")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user