mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-21 20:44:18 +00:00
aggiunto verifica creazione utente
This commit is contained in:
parent
a3f5139b76
commit
eae6e3eb17
1 changed files with 25 additions and 0 deletions
25
code/backend/nest_backend/test/user_create_test.py
Normal file
25
code/backend/nest_backend/test/user_create_test.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import requests
|
||||
import json
|
||||
|
||||
auth_code = ""
|
||||
|
||||
|
||||
def test_user_create():
|
||||
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/create', headers={'authorization': "Bearer " + auth_code},
|
||||
json={'email': 'utente5@nest.com', 'password': '1234', 'username': 'utente5'})
|
||||
j = json.loads(r.text)
|
||||
assert j['result'] == "success"
|
||||
|
||||
auth_code = j['data']['access_token']
|
||||
print("User_create eseguito correttamente!")
|
||||
|
||||
|
||||
print("Testing del metodo user_create")
|
||||
test_user_create()
|
Loading…
Reference in a new issue