1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-21 20:44:18 +00:00

test repository

This commit is contained in:
stefanogoldoni 2021-05-12 23:39:29 +02:00
parent b0217d6f36
commit 1bc59c76bc

View file

@ -19,7 +19,6 @@ class TestRepositoryGetAll:
# assert r.json["data"]["isAdmin"] is True
class TestRepositoryAdd:
def test_for_success(self, flask_client: Client, user_headers):
r = flask_client.post(f'/api/v1/repositories/', headers=user_headers, json={
@ -37,7 +36,6 @@ class TestRepositoryAdd:
assert r.json["result"] == "success"
assert r.json["data"]["is_active"] is True
# non vengono passate le condizioni necessarie, in questo caso il nome della repository
def test_for_failure(self, flask_client: Client, user_headers):
r = flask_client.post(f'/api/v1/repositories/', headers=user_headers, json={
@ -49,12 +47,42 @@ class TestRepositoryAdd:
}
],
'evaluation_mode': 0,
'is_active': True
})
assert r.json["msg"] == "Missing arguments."
assert r.json["result"] == "failure"
# viene passato un campo evaluation_mode con valore non previsto dall'enum
def test_wrong_evaluation_mode(self, flask_client: Client, user_headers):
r = flask_client.post(f'/api/v1/repositories/', headers=user_headers, json={
'conditions': [
{
'content': 'PdS2021',
'id': 0,
'type': 0
}
],
'evaluation_mode': 99,
'name': 'repo_test',
'is_active': True
})
assert r.json["result"] == "failure"
# viene passato un campo type con valore non previsto dall'enum
def test_wrong_condition(self, flask_client: Client, user_headers):
r = flask_client.post(f'/api/v1/repositories/', headers=user_headers, json={
'conditions': [
{
'content': 'PdS2021',
'id': 0,
'type': 99
}
],
'evaluation_mode': 2,
'name': 'repo_test',
'is_active': True
})
assert r.json["result"] == "failure"
'''
class TestUserDelete: