From 495c7a6df148682bbd26bdb0ac3e53c76ce918c9 Mon Sep 17 00:00:00 2001 From: stefanogoldoni Date: Thu, 13 May 2021 22:52:18 +0200 Subject: [PATCH] test repository --- nest_backend/test/test_zrepository.py | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/nest_backend/test/test_zrepository.py b/nest_backend/test/test_zrepository.py index 6da3c40..babf5ba 100644 --- a/nest_backend/test/test_zrepository.py +++ b/nest_backend/test/test_zrepository.py @@ -99,6 +99,41 @@ class TestRepositoryGet: assert r.json["result"] == "failure" +class TestRepositoryPatch: + def test_wrong_owner(self, flask_client: Client, admin_headers): + r = flask_client.get(f'/api/v1/repositories/1', headers=admin_headers) + assert r.status_code == 403 + assert r.json["result"] == "failure" + + def test_unknown_type(self, flask_client: Client, admin_headers): + r = flask_client.get(f'/api/v1/repositories/1', headers=admin_headers, + json={ + "name": "string", + "close": "string", + "open": "string", + "evaluation_mode": 99 + }) + assert r.status_code == 400 + assert r.json["result"] == "failure" + + def test_for_success(self, flask_client: Client, user_headers): + r = flask_client.get(f'/api/v1/repositories/1', headers=user_headers, + json={ + "name": "nuovo_nome", + "close": "false", + "open": "false", + "evaluation_mode": 1 + }) + assert r.status_code == 200 + assert r.json["result"] == "success" + +class TestRepositoryDelete: + pass + + +class TestRepositoryPut: + pass + ''' class TestUserDelete: def test_for_success(self, flask_client: Client, admin_headers):