mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-21 20:44:18 +00:00
risolti bug e aggiunti un paio di test
This commit is contained in:
parent
009cfa49f6
commit
34ecba7319
5 changed files with 11 additions and 7 deletions
|
@ -6,3 +6,8 @@ from flask.testing import Client
|
|||
def test_doa(flask_client: Client, admin_headers):
|
||||
response = flask_client.get("/doa", headers=admin_headers)
|
||||
assert b"If you see this, the server is fine." in response.data
|
||||
|
||||
|
||||
def test_sq_told_me_to_do_this(flask_client: Client, user_headers):
|
||||
response = flask_client.post("/doa", headers=user_headers)
|
||||
assert b"Hello there." in response.data
|
||||
|
|
|
@ -24,7 +24,7 @@ class TestUserGetAll:
|
|||
assert r.json["result"] == "success"
|
||||
|
||||
def test_for_failure(self, flask_client: Client, user_headers):
|
||||
r = flask_client.get(f'/api/v1/users/', headers=user_headers)
|
||||
r = flask_client.patch(f'/api/v1/users/', headers=user_headers)
|
||||
assert r.json["result"] == "failure"
|
||||
|
||||
|
||||
|
|
|
@ -213,8 +213,8 @@ class TestRepositoryPut:
|
|||
assert r.status_code == 404
|
||||
assert r.json["result"] == "failure"
|
||||
|
||||
def test_for_success(self, flask_client: Client, admin_headers):
|
||||
r = flask_client.put(f'/api/v1/repositories/1', headers=admin_headers, json={
|
||||
def test_for_success(self, flask_client: Client, user_headers):
|
||||
r = flask_client.put(f'/api/v1/repositories/1', headers=user_headers, json={
|
||||
"conditions": [
|
||||
{
|
||||
"content": "string",
|
||||
|
|
|
@ -12,8 +12,8 @@ class TestConditionGetAllOfARepository:
|
|||
assert r.status_code == 404
|
||||
assert r.json["result"] == "failure"
|
||||
|
||||
def test__unauthorized_repository(self, flask_client: Client, admin_headers):
|
||||
r = flask_client.get(f'/api/v1/repositories/1/conditions/', headers=admin_headers)
|
||||
def test__unauthorized_user(self, flask_client: Client, user_headers):
|
||||
r = flask_client.get(f'/api/v1/repositories/2/conditions/', headers=user_headers)
|
||||
assert r.status_code == 403
|
||||
assert r.json["result"] == "failure"
|
||||
|
||||
|
|
|
@ -74,9 +74,8 @@ class TestAuthorizationsPut:
|
|||
|
||||
class TestAuthorizationsDelete:
|
||||
def test_for_success(self, flask_client: Client, user_headers):
|
||||
r = flask_client.delete(f'/api/v1/repositories/1/authorizations/user_test@nest.com', headers=user_headers)
|
||||
r = flask_client.delete(f'/api/v1/repositories/1/authorizations/admin@admin.com', headers=user_headers)
|
||||
assert r.status_code == 204
|
||||
assert r.json["result"] == "success"
|
||||
|
||||
def test_user_not_logged(self, flask_client: Client):
|
||||
r = flask_client.delete(f'/api/v1/repositories/1/authorizations/user_test@nest.com')
|
||||
|
|
Loading…
Reference in a new issue