Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
IGWN Computing and Software
GraceDB
GraceDB Server
Commits
e01b98cd
Commit
e01b98cd
authored
6 years ago
by
Tanner Prestegard
Committed by
GraceDB
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add access tests for main API urls
parent
a1ad902f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gracedb/api/v1/main/tests/__init__.py
+0
-0
0 additions, 0 deletions
gracedb/api/v1/main/tests/__init__.py
gracedb/api/v1/main/tests/test_access.py
+44
-0
44 additions, 0 deletions
gracedb/api/v1/main/tests/test_access.py
with
44 additions
and
0 deletions
gracedb/api/v1/main/tests/__init__.py
0 → 100644
+
0
−
0
View file @
e01b98cd
This diff is collapsed.
Click to expand it.
gracedb/api/v1/main/tests/test_access.py
0 → 100644
+
44
−
0
View file @
e01b98cd
from
__future__
import
absolute_import
from
django.conf
import
settings
from
django.urls
import
reverse
from
api.tests.utils
import
GraceDbApiTestBase
from
...settings
import
API_VERSION
def
v_reverse
(
viewname
,
*
args
,
**
kwargs
):
"""
Easily customizable versioned API reverse for testing
"""
viewname
=
'
api:{version}:
'
.
format
(
version
=
API_VERSION
)
+
viewname
return
reverse
(
viewname
,
*
args
,
**
kwargs
)
class
TestPublicAccess
(
GraceDbApiTestBase
):
def
test_api_root
(
self
):
"""
Unauthenticated user can access API root
"""
url
=
v_reverse
(
'
root
'
)
response
=
self
.
request_as_user
(
url
,
"
GET
"
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_tag_list
(
self
):
"""
Unauthenticated user can access tag list
"""
url
=
v_reverse
(
'
tag-list
'
)
response
=
self
.
request_as_user
(
url
,
"
GET
"
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_public_user_performance_info
(
self
):
"""
Unauthenticated user can
'
t access performance info
"""
url
=
v_reverse
(
'
performance-info
'
)
response
=
self
.
request_as_user
(
url
,
"
GET
"
)
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertIn
(
"
Authentication credentials were not provided
"
,
response
.
content
)
def
test_lvem_user_performance_info
(
self
):
"""
LV-EM user can
'
t access performance info
"""
url
=
v_reverse
(
'
performance-info
'
)
response
=
self
.
request_as_user
(
url
,
"
GET
"
,
self
.
lvem_user
)
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertIn
(
"
Forbidden
"
,
response
.
content
)
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