Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
ba32bd08
Commit
ba32bd08
authored
Jan 11, 2017
by
Marko Jevtic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test owner
parent
8e33ec52
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
openedx/core/djangoapps/user_api/verification_api/tests/test_views.py
+9
-6
No files found.
openedx/core/djangoapps/user_api/verification_api/tests/test_views.py
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment