Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
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
ba32bd08
Commit
ba32bd08
authored
8 years ago
by
Marko Jevtic
Browse files
Options
Downloads
Patches
Plain Diff
Fix test owner
parent
8e33ec52
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openedx/core/djangoapps/user_api/verification_api/tests/test_views.py
+9
-6
9 additions, 6 deletions
.../djangoapps/user_api/verification_api/tests/test_views.py
with
9 additions
and
6 deletions
openedx/core/djangoapps/user_api/verification_api/tests/test_views.py
+
9
−
6
View file @
ba32bd08
...
...
@@ -26,8 +26,8 @@ class PhotoVerificationStatusViewTests(TestCase):
def
setUp
(
self
):
super
(
PhotoVerificationStatusViewTests
,
self
).
setUp
()
self
.
user
=
UserFactory
.
create
(
password
=
self
.
PASSWORD
)
self
.
staff
=
UserFactory
.
create
(
is_staff
=
True
,
password
=
self
.
PASSWORD
)
self
.
user
=
UserFactory
(
password
=
self
.
PASSWORD
)
self
.
staff
=
UserFactory
(
is_staff
=
True
,
password
=
self
.
PASSWORD
)
self
.
verification
=
SoftwareSecurePhotoVerification
.
objects
.
create
(
user
=
self
.
user
,
status
=
'
submitted
'
)
self
.
path
=
reverse
(
'
verification_status
'
,
kwargs
=
{
'
username
'
:
self
.
user
.
username
})
self
.
client
.
login
(
username
=
self
.
staff
.
username
,
password
=
self
.
PASSWORD
)
...
...
@@ -57,7 +57,7 @@ class PhotoVerificationStatusViewTests(TestCase):
def
test_no_verifications
(
self
):
"""
The endpoint should return HTTP 404 if the user has no verifications.
"""
user
=
UserFactory
.
create
()
user
=
UserFactory
()
path
=
reverse
(
'
verification_status
'
,
kwargs
=
{
'
username
'
:
user
.
username
})
self
.
assert_path_not_found
(
path
)
...
...
@@ -69,17 +69,19 @@ class PhotoVerificationStatusViewTests(TestCase):
def
test_staff_user
(
self
):
"""
The endpoint should be accessible to staff users.
"""
self
.
client
.
logout
()
self
.
client
.
login
(
username
=
self
.
staff
.
username
,
password
=
self
.
PASSWORD
)
self
.
assert_verification_returned
()
def
test_owner
(
self
):
"""
The endpoint should be accessible to the user who submitted the verification request.
"""
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
self
.
user
.
password
)
self
.
client
.
logout
()
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
self
.
PASSWORD
)
self
.
assert_verification_returned
()
def
test_non_owner_or_staff_user
(
self
):
"""
The endpoint should NOT be accessible if the request is not made by the submitter or staff user.
"""
user
=
UserFactory
.
create
()
user
=
UserFactory
()
self
.
client
.
login
(
username
=
user
.
username
,
password
=
self
.
PASSWORD
)
response
=
self
.
client
.
get
(
self
.
path
)
self
.
assertEqual
(
response
.
status_code
,
403
)
...
...
@@ -88,5 +90,6 @@ class PhotoVerificationStatusViewTests(TestCase):
"""
The endpoint should return that the user is verified if the user
'
s verification is accepted.
"""
self
.
verification
.
status
=
'
approved
'
self
.
verification
.
save
()
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
self
.
user
.
password
)
self
.
client
.
logout
()
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
self
.
PASSWORD
)
self
.
assert_verification_returned
(
verified
=
True
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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