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
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
889f5e4e
Unverified
Commit
889f5e4e
authored
5 years ago
by
Farhanah Sheets
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #21212 from edx/fsheets/PROD-500
Fix: Do not compare Software Secure expiry_date when NULL
parents
99868f9f
fed53227
Branches
Branches containing commit
Tags
release-2020-04-16-15.19
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/verify_student/models.py
+4
-1
4 additions, 1 deletion
lms/djangoapps/verify_student/models.py
lms/djangoapps/verify_student/tests/test_models.py
+21
-1
21 additions, 1 deletion
lms/djangoapps/verify_student/tests/test_models.py
with
25 additions
and
2 deletions
lms/djangoapps/verify_student/models.py
+
4
−
1
View file @
889f5e4e
...
...
@@ -943,7 +943,10 @@ class SoftwareSecurePhotoVerification(PhotoVerification):
Returns:
SoftwareSecurePhotoVerification (object) or None
"""
recent_verification
=
SoftwareSecurePhotoVerification
.
objects
.
filter
(
status
=
'
approved
'
,
user_id
=
user
.
id
)
recent_verification
=
SoftwareSecurePhotoVerification
.
objects
.
filter
(
status
=
'
approved
'
,
user_id
=
user
.
id
,
expiry_date__isnull
=
False
)
return
recent_verification
.
latest
(
'
updated_at
'
)
if
recent_verification
.
exists
()
else
None
@classmethod
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/verify_student/tests/test_models.py
+
21
−
1
View file @
889f5e4e
# -*- coding: utf-8 -*-
import
json
from
datetime
import
timedelta
from
datetime
import
datetime
,
timedelta
import
boto
import
ddt
...
...
@@ -380,6 +380,7 @@ class TestPhotoVerification(TestVerification, MockS3Mixin, ModuleStoreTestCase):
# Make an approved verification
attempt
=
SoftwareSecurePhotoVerification
(
user
=
user
)
attempt
.
status
=
'
approved
'
attempt
.
expiry_date
=
datetime
.
now
()
attempt
.
save
()
# Test method 'get_recent_verification' returns the most recent
...
...
@@ -388,6 +389,25 @@ class TestPhotoVerification(TestVerification, MockS3Mixin, ModuleStoreTestCase):
self
.
assertIsNotNone
(
recent_verification
)
self
.
assertEqual
(
recent_verification
.
id
,
attempt
.
id
)
def
test_get_recent_verification_expiry_null
(
self
):
"""
Test that method
'
get_recent_verification
'
of model
'
SoftwareSecurePhotoVerification
'
will return None when expiry_date
is NULL for
'
approved
'
verifications based on updated_at value.
"""
user
=
UserFactory
.
create
()
attempt
=
None
for
_
in
range
(
2
):
# Make an approved verification
attempt
=
SoftwareSecurePhotoVerification
(
user
=
user
)
attempt
.
status
=
'
approved
'
attempt
.
save
()
# Test method 'get_recent_verification' returns None
# as attempts don't have an expiry_date
recent_verification
=
SoftwareSecurePhotoVerification
.
get_recent_verification
(
user
=
user
)
self
.
assertIsNone
(
recent_verification
)
def
test_no_approved_verification
(
self
):
"""
Test that method
'
get_recent_verification
'
of model
'
SoftwareSecurePhotoVerification
'
returns None if no
...
...
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