Skip to content

Commit

Permalink
feat: comment on to-be-removed function
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharis278 committed Sep 9, 2024
1 parent 23c5242 commit f7ddb7d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
5 changes: 0 additions & 5 deletions lms/djangoapps/verify_student/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
11 changes: 9 additions & 2 deletions lms/djangoapps/verify_student/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 9 additions & 3 deletions lms/djangoapps/verify_student/tests/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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'])
Expand Down

0 comments on commit f7ddb7d

Please sign in to comment.