mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 13:04:19 +00:00
aggiunti test metodi add, delete e get
This commit is contained in:
parent
d7e175c3f5
commit
01ed2eadc9
3 changed files with 26 additions and 0 deletions
9
code/backend/nest_backend/test/test_user_add.py
Normal file
9
code/backend/nest_backend/test/test_user_add.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
from flask.testing import Client
|
||||||
|
|
||||||
|
# test add user utente_test
|
||||||
|
|
||||||
|
|
||||||
|
def test_user_add(flask_client: Client, access_token: str):
|
||||||
|
r = flask_client.post(f'/api/v1/users/', headers={'Authorization': f"Bearer {access_token}"},
|
||||||
|
json={'email': 'utente_test@nest.com', 'password': 'password', 'username': 'utente_test'})
|
||||||
|
assert b'success' in r.data
|
8
code/backend/nest_backend/test/test_user_delete.py
Normal file
8
code/backend/nest_backend/test/test_user_delete.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from flask.testing import Client
|
||||||
|
|
||||||
|
# test delete user utente_test
|
||||||
|
|
||||||
|
|
||||||
|
def test_user_delete(flask_client: Client, access_token: str):
|
||||||
|
r = flask_client.delete(f'/api/v1/users/utente_test@nest.com', headers={'Authorization': f"Bearer {access_token}"})
|
||||||
|
assert b'success' in r.data
|
9
code/backend/nest_backend/test/test_user_get.py
Normal file
9
code/backend/nest_backend/test/test_user_get.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
from flask.testing import Client
|
||||||
|
|
||||||
|
# test get user admin
|
||||||
|
|
||||||
|
|
||||||
|
def test_user_get(flask_client: Client, access_token: str):
|
||||||
|
r = flask_client.get(f'/api/v1/users/admin@admin.com', headers={'Authorization': f"Bearer {access_token}"})
|
||||||
|
assert b'success' in r.data
|
||||||
|
|
Loading…
Reference in a new issue