From a41afa415f9ccb455197d9a7253654cef5d6e197 Mon Sep 17 00:00:00 2001 From: Annielated Date: Wed, 28 Apr 2021 00:44:21 +0200 Subject: [PATCH] user_create testata e funzionante --- .../nest_backend/test/user_create_test.py | 2 +- .../nest_backend/test/user_delete_test.py | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 code/backend/nest_backend/test/user_delete_test.py diff --git a/code/backend/nest_backend/test/user_create_test.py b/code/backend/nest_backend/test/user_create_test.py index 9d9c12f..d98fef0 100644 --- a/code/backend/nest_backend/test/user_create_test.py +++ b/code/backend/nest_backend/test/user_create_test.py @@ -13,7 +13,7 @@ def test_user_create(): auth_code = j['data']['access_token'] r = requests.post(f'http://localhost:5000/api/user/create', headers={'authorization': "Bearer " + auth_code}, - json={'email': 'utente11@nest.com', 'password': '1234', 'username': 'utente11'}) + json={'email': 'utente12@nest.com', 'password': '1234', 'username': 'utente12'}) j = json.loads(r.text) assert j['result'] == "success" diff --git a/code/backend/nest_backend/test/user_delete_test.py b/code/backend/nest_backend/test/user_delete_test.py new file mode 100644 index 0000000..41e984e --- /dev/null +++ b/code/backend/nest_backend/test/user_delete_test.py @@ -0,0 +1,24 @@ +import requests +import json + +auth_code = "" + + +def test_user_delete(): + 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.post(f'http://localhost:5000/api/user/remove', headers={'authorization': "Bearer " + auth_code}, + json={'email': 'utente10@nest.com'}) + j = json.loads(r.text) + assert j['result'] == "success" + + print("User_delete eseguito correttamente!") + + +print("Testing del metodo user_delete") +test_user_delete()