From 78fd6952109e41b4534451b58355c22db6d02459 Mon Sep 17 00:00:00 2001 From: Giovanni Anniballi <253150@studenti.unimore.it> Date: Wed, 28 Apr 2021 21:35:32 +0000 Subject: [PATCH] incompleto --- .../nest_backend/test/repository_edit_test.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 code/backend/nest_backend/test/repository_edit_test.py diff --git a/code/backend/nest_backend/test/repository_edit_test.py b/code/backend/nest_backend/test/repository_edit_test.py new file mode 100644 index 0000000..cd7c24b --- /dev/null +++ b/code/backend/nest_backend/test/repository_edit_test.py @@ -0,0 +1,27 @@ +import json +import unittest +import requests + + +class MyTestCase(unittest.TestCase): + def test_repository_edit(self): + global auth_code + + r = requests.post('http://localhost:5000/api/login', json={'email': 'admin@admin.com', 'password': 'password'}) + j = json.loads(r.text) + assert j['result'] == "success" + auth_code = j['data']['access_token'] + + r = requests.put(f'http://localhost:5000/api/repository/edit', headers={'authorization': "Bearer " + auth_code}, + json={'id': '1', 'name': 'newname'}) + j = json.loads(r.text) + assert j['result'] == "success" + + print('Repository_edit eseguito correttamente!') + + +print('Testing del metodo repository_edit') + + + +