From b0b0038a7a12836a2878451fdd44aa1b03a56920 Mon Sep 17 00:00:00 2001 From: Annielated Date: Wed, 28 Apr 2021 23:18:38 +0200 Subject: [PATCH] =?UTF-8?q?le=20repository=20vengono=20create=20correttame?= =?UTF-8?q?nte,=20servono=20per=C3=B2=20ulteriori=20controlli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/repository_create_test.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 code/backend/nest_backend/test/repository_create_test.py diff --git a/code/backend/nest_backend/test/repository_create_test.py b/code/backend/nest_backend/test/repository_create_test.py new file mode 100644 index 0000000..fa69d2c --- /dev/null +++ b/code/backend/nest_backend/test/repository_create_test.py @@ -0,0 +1,27 @@ +import requests +import json +import unittest + + +auth_code = "" + + +class MyTestCase(unittest.TestCase): + def test_repository_create(self): + global auth_code + + r = requests.post('http://localhost:5000/api/login', json={'email': 'utente13@nest.com', 'password': ''}) + j = json.loads(r.text) + assert j['result'] == "success" + auth_code = j['data']['access_token'] + + r = requests.post(f'http://localhost:5000/api/repository/create', headers={'authorization': "Bearer " + auth_code}, + json={'name': 'prova3', 'owner_id': 'email'}) + j = json.loads(r.text) + assert j['result'] == "success" + + print("Repository_create eseguito correttamente!") + + +print("Testing del metodo repository_create") +