mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-21 20:44:18 +00:00
piccoli fix alla struttura dei test
This commit is contained in:
parent
8bed7d5962
commit
37392b576f
2 changed files with 24 additions and 11 deletions
|
@ -130,6 +130,11 @@ class TestRepositoryGet:
|
|||
assert r.status_code == 404
|
||||
assert r.json["result"] == "failure"
|
||||
|
||||
def test_wrong_request_type(self, flask_client: Client, admin_headers):
|
||||
r = flask_client.put(f'/api/v1/repositories/99', headers=admin_headers)
|
||||
assert r.status_code == 404
|
||||
assert r.json["result"] == "failure"
|
||||
|
||||
def test_user__not_logged(self, flask_client: Client, ):
|
||||
r = flask_client.get(f'/api/v1/repositories/1')
|
||||
assert r.status_code == 401
|
||||
|
@ -168,6 +173,10 @@ class TestRepositoryPatch:
|
|||
})
|
||||
assert r.status_code == 204
|
||||
|
||||
def test_error_500(self, flask_client: Client, user_headers):
|
||||
r = flask_client.patch(f'/api/v99/repositories/1', headers=user_headers)
|
||||
assert r.status_code == 500
|
||||
|
||||
|
||||
class TestRepositoryDelete:
|
||||
def test_wrong_owner(self, flask_client: Client, user_headers):
|
||||
|
@ -198,8 +207,7 @@ class TestRepositoryPut:
|
|||
assert r.status_code == 401
|
||||
|
||||
def test_bad_request(self, flask_client: Client, user_headers):
|
||||
r = flask_client.put(f'/api/v1/repositories/1', headers=user_headers,
|
||||
json={
|
||||
r = flask_client.put(f'/api/v1/repositories/1', headers=user_headers, json={
|
||||
"name": "string",
|
||||
"close": "string",
|
||||
"open": "string",
|
||||
|
@ -236,3 +244,7 @@ class TestRepositoryPut:
|
|||
"start": "2021-05-14T12:12:29.827Z"
|
||||
})
|
||||
assert r.status_code == 200
|
||||
|
||||
def test_error_500(self, flask_client: Client, user_headers):
|
||||
r = flask_client.put(f'/api/v99/repositories/1', headers=user_headers)
|
||||
assert r.status_code == 500
|
||||
|
|
|
@ -157,12 +157,7 @@ class TestAlertPost:
|
|||
assert r.json["result"] == "success"
|
||||
|
||||
|
||||
|
||||
|
||||
# test del file alert
|
||||
|
||||
|
||||
class TestOneAlertOfARepository:
|
||||
class TestAlertGet:
|
||||
def test_alert_not_found(self, flask_client: Client, user_headers):
|
||||
r = flask_client.get(f'/api/v1/alert/99', headers=user_headers)
|
||||
assert r.status_code == 404
|
||||
|
@ -174,7 +169,7 @@ class TestOneAlertOfARepository:
|
|||
assert r.status_code == 200
|
||||
assert r.json["result"] == "success"
|
||||
|
||||
# test PATCH
|
||||
|
||||
def test_patch_alert_no_json(self, flask_client: Client, user_headers):
|
||||
r = flask_client.patch(f'/api/v1/alert/1', headers=user_headers)
|
||||
assert r.status_code == 400
|
||||
|
@ -197,7 +192,8 @@ class TestOneAlertOfARepository:
|
|||
assert r.status_code == 200
|
||||
assert r.json["result"] == "success"
|
||||
|
||||
# test PUT
|
||||
|
||||
class TestAlertPut:
|
||||
def test_put_alert_no_json(self, flask_client: Client, user_headers):
|
||||
r = flask_client.put(f'/api/v1/alert/2', headers=user_headers)
|
||||
assert r.status_code == 400
|
||||
|
@ -309,7 +305,12 @@ class TestOneAlertOfARepository:
|
|||
assert r.status_code == 400
|
||||
assert r.json["result"] == "failure"
|
||||
|
||||
# test DELETE
|
||||
|
||||
class TestAlertDelete:
|
||||
def test_delete_alert_for_success(self, flask_client: Client, user_headers):
|
||||
r = flask_client.delete(f'/api/v1/alert/1', headers=user_headers)
|
||||
assert r.status_code == 204
|
||||
|
||||
def test_error_500(self, flask_client: Client, user_headers):
|
||||
r = flask_client.delete(f'/api/v99/alert/1', headers=user_headers)
|
||||
assert r.status_code == 500
|
||||
|
|
Loading…
Reference in a new issue