mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 06:24:19 +00:00
primi test sulle autorizzazioni
This commit is contained in:
parent
6c1f907d78
commit
f1b8838361
1 changed files with 20 additions and 0 deletions
20
nest_backend/test/test_5_authorizations.py
Normal file
20
nest_backend/test/test_5_authorizations.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
from flask.testing import Client
|
||||
|
||||
'''A file that contains tests classes and methods for all the requests concerning authorizations .'''
|
||||
|
||||
|
||||
class TestAuthozitazionsGet:
|
||||
def test_for_success(self, flask_client: Client, user_headers):
|
||||
r = flask_client.get('/api/v1/repositories/1/authorizations/', headers=user_headers)
|
||||
assert r.status_code == 200
|
||||
assert r.json["result"] == "success"
|
||||
|
||||
def test_get_non_existing_repository(self, flask_client: Client, admin_headers):
|
||||
r = flask_client.get('/api/v1/repositories/99/authorizations/', headers=admin_headers)
|
||||
assert r.status_code == 404
|
||||
assert r.json["result"] == "failure"
|
||||
|
||||
def test_wrong_owner(self, flask_client: Client, admin_headers):
|
||||
r = flask_client.get(f'/api/v1/repositories/1/authorizations/', headers=admin_headers)
|
||||
assert r.status_code == 403
|
||||
assert r.json["result"] == "failure"
|
Loading…
Reference in a new issue