From e6134abaaff659dee4526de1b4aafeca67424e7f Mon Sep 17 00:00:00 2001 From: stefanogoldoni Date: Sat, 1 May 2021 12:28:26 +0200 Subject: [PATCH] aggiunto test del metodo get --- .../test/{user_delete_test.py => user_test.py} | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) rename code/backend/nest_backend/test/{user_delete_test.py => user_test.py} (85%) diff --git a/code/backend/nest_backend/test/user_delete_test.py b/code/backend/nest_backend/test/user_test.py similarity index 85% rename from code/backend/nest_backend/test/user_delete_test.py rename to code/backend/nest_backend/test/user_test.py index 36322b6..0f67f24 100644 --- a/code/backend/nest_backend/test/user_delete_test.py +++ b/code/backend/nest_backend/test/user_test.py @@ -17,7 +17,7 @@ class MyTestCase(unittest.TestCase): # elimino ma non sono admin r = requests.delete(f'http://localhost:5000/api/v1/users/admin@admin.com', - headers={'authorization': "Bearer " + auth_code},) + headers={'authorization': "Bearer " + auth_code}) j = json.loads(r.text) assert j['result'] == "failure" @@ -31,25 +31,32 @@ class MyTestCase(unittest.TestCase): # elimino un utente che non c'รจ r = requests.delete(f'http://localhost:5000/api/v1/users/none@nest.com', - headers={'authorization': "Bearer " + auth_code},) + headers={'authorization': "Bearer " + auth_code}) j = json.loads(r.text) assert j['result'] == "failure" print("delete User NON eseguito correttamente!") r = requests.delete(f'http://localhost:5000/api/v1/users/admin@admin.com', - headers={'authorization': "Bearer " + auth_code},) + headers={'authorization': "Bearer " + auth_code}) j = json.loads(r.text) assert j['result'] == "failure" print("delete User NON eseguito correttamente!") r = requests.delete(f'http://localhost:5000/api/v1/users/utente3@nest.com', - headers={'authorization': "Bearer " + auth_code},) + headers={'authorization': "Bearer " + auth_code}) j = json.loads(r.text) assert j['result'] == "success" # TODO AGGIUNGERE TESTING DI GET E PATCH + + # chiedo le info di un utente che esiste + r = requests.get(f'http://localhost:5000/api/v1/users/utente_test@nest.com', + headers={'authorization': "Bearer " + auth_code}) + j = json.loads(r.text) + assert j['result'] == "success" + print("User_delete eseguito correttamente!") print("Testing del metodo user delete")