diff --git a/lms/djangoapps/verify_student/models.py b/lms/djangoapps/verify_student/models.py index 6dadd14634e4..e0b6c7643c8e 100644 --- a/lms/djangoapps/verify_student/models.py +++ b/lms/djangoapps/verify_student/models.py @@ -1215,11 +1215,6 @@ class VerificationAttempt(TimeStampedModel): blank=True, ) - @property - def expiration_datetime(self): - """Backwards compatibility with existing IDVerification models""" - return self.expiration_date - @property def updated_at(self): """Backwards compatibility with existing IDVerification models""" diff --git a/lms/djangoapps/verify_student/services.py b/lms/djangoapps/verify_student/services.py index 5b88025719ca..2a5f77e3fbfb 100644 --- a/lms/djangoapps/verify_student/services.py +++ b/lms/djangoapps/verify_student/services.py @@ -251,11 +251,18 @@ def get_verification_details_by_id(cls, attempt_id): """ Returns a verification attempt object by attempt_id If the verification object cannot be found, returns None + + This method does not take into account verifications stored in the + VerificationAttempt model used for pluggable IDV implementations. + + As part of the work to implement pluggable IDV, this method's use + will be deprecated: DEPR-XXX """ verification = None - # TODO: Not updated for new model since we can't query multiple tables - # by id. + # This does not look at the VerificationAttempt model since the provided id would become + # ambiguous between tables. The verification models in this list all inherit from the same + # base class and share the same id space. verification_models = [ SoftwareSecurePhotoVerification, SSOVerification, diff --git a/lms/djangoapps/verify_student/tests/test_services.py b/lms/djangoapps/verify_student/tests/test_services.py index 19c85d9149ab..5351e3ede699 100644 --- a/lms/djangoapps/verify_student/tests/test_services.py +++ b/lms/djangoapps/verify_student/tests/test_services.py @@ -58,7 +58,10 @@ def test_user_is_verified(self, verification_model): assert not IDVerificationService.user_is_verified(user), status attempt.status = "approved" - attempt.expiration_date = now() + timedelta(days=19) + if verification_model == VerificationAttempt: + attempt.expiration_datetime = now() + timedelta(days=19) + else: + attempt.expiration_date = now() + timedelta(days=19) attempt.save() assert IDVerificationService.user_is_verified(user), attempt.status @@ -84,7 +87,10 @@ def test_user_has_valid_or_pending(self, verification_model): # -- must_retry, and submitted both count until we hear otherwise for status in ["submitted", "must_retry", "approved"]: attempt.status = status - attempt.expiration_date = now() + timedelta(days=19) + if verification_model == VerificationAttempt: + attempt.expiration_datetime = now() + timedelta(days=19) + else: + attempt.expiration_date = now() + timedelta(days=19) attempt.save() assert IDVerificationService.user_has_valid_or_pending(user), status @@ -188,7 +194,7 @@ def test_get_expiration_datetime_mixed_models(self): user=user, status='approved', expiration_date=datetime(2021, 11, 12, 0, 0, tzinfo=timezone.utc) ) newest = VerificationAttempt.objects.create( - user=user, status='approved', expiration_date=datetime(2022, 1, 12, 0, 0, tzinfo=timezone.utc) + user=user, status='approved', expiration_datetime=datetime(2022, 1, 12, 0, 0, tzinfo=timezone.utc) ) expiration_datetime = IDVerificationService.get_expiration_datetime(user, ['approved'])