mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 14:34:19 +00:00
user_create testata e funzionante
This commit is contained in:
parent
c708e6bfff
commit
a41afa415f
2 changed files with 25 additions and 1 deletions
|
@ -13,7 +13,7 @@ def test_user_create():
|
||||||
auth_code = j['data']['access_token']
|
auth_code = j['data']['access_token']
|
||||||
|
|
||||||
r = requests.post(f'http://localhost:5000/api/user/create', headers={'authorization': "Bearer " + auth_code},
|
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)
|
j = json.loads(r.text)
|
||||||
assert j['result'] == "success"
|
assert j['result'] == "success"
|
||||||
|
|
||||||
|
|
24
code/backend/nest_backend/test/user_delete_test.py
Normal file
24
code/backend/nest_backend/test/user_delete_test.py
Normal file
|
@ -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()
|
Loading…
Reference in a new issue