Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
e4366646
Commit
e4366646
authored
4 years ago
by
Bianca Severino
Browse files
Options
Downloads
Patches
Plain Diff
Default to expiry_date for older software secure photo verifications
parent
6424a3f3
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/verify_student/models.py
+7
-0
7 additions, 0 deletions
lms/djangoapps/verify_student/models.py
lms/djangoapps/verify_student/tests/test_models.py
+19
-0
19 additions, 0 deletions
lms/djangoapps/verify_student/tests/test_models.py
with
26 additions
and
0 deletions
lms/djangoapps/verify_student/models.py
+
7
−
0
View file @
e4366646
...
...
@@ -647,6 +647,13 @@ class SoftwareSecurePhotoVerification(PhotoVerification):
# to notify for expired verification is already sent.
expiry_email_date
=
models
.
DateTimeField
(
null
=
True
,
blank
=
True
,
db_index
=
True
)
@property
def
expiration_datetime
(
self
):
"""
Use expiry_date for older entries if it still exists.
"""
if
self
.
expiry_date
:
return
self
.
expiry_date
return
super
(
SoftwareSecurePhotoVerification
,
self
).
expiration_datetime
@classmethod
def
get_initial_verification
(
cls
,
user
,
earliest_allowed_date
=
None
):
"""
Get initial verification for a user with the
'
photo_id_key
'
.
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/verify_student/tests/test_models.py
+
19
−
0
View file @
e4366646
...
...
@@ -396,6 +396,25 @@ class TestPhotoVerification(TestVerificationBase, MockS3BotoMixin, ModuleStoreTe
verification
.
created_at
+
timedelta
(
days
=
FAKE_SETTINGS
[
"
DAYS_GOOD_FOR
"
])
)
def
test_deprecated_expiry_date
(
self
):
"""
Test `expiration_datetime` returns `expiry_date` if it is not null.
"""
user
=
UserFactory
.
create
()
with
freeze_time
(
now
()):
verification
=
SoftwareSecurePhotoVerification
(
user
=
user
)
# First, assert that expiration_date is set correctly
self
.
assertEqual
(
verification
.
expiration_datetime
,
now
()
+
timedelta
(
days
=
FAKE_SETTINGS
[
"
DAYS_GOOD_FOR
"
])
)
verification
.
expiry_date
=
now
()
+
timedelta
(
days
=
10
)
# Then, assert that expiration_datetime favors expiry_date's value if set
self
.
assertEqual
(
verification
.
expiration_datetime
,
now
()
+
timedelta
(
days
=
10
)
)
class
SSOVerificationTest
(
TestVerificationBase
):
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment