1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 06:24:19 +00:00

Test user completati, get e patch danno problemi per test che dovrebbero fallire

This commit is contained in:
Annielated 2021-05-08 18:50:04 +02:00
parent ef6852037c
commit 47d08da877

View file

@ -1,5 +1,7 @@
from flask.testing import Client
'''A file that contains tests of classes and methods for all the requests concerning an user.'''
class TestUserGet:
def test_for_success(self, flask_client: Client, admin_headers):
@ -7,6 +9,18 @@ class TestUserGet:
assert b'success' in r.data
# ritorna i dati di tutti gli utenti registrati
class TestUserGetAll:
def test_for_success(self, flask_client: Client, admin_headers):
r = flask_client.get(f'/api/v1/users/', headers=admin_headers)
assert b'success' in r.data
# FIXME AssertionError in flask_client at line 63. Il test non riesce ad andare a buon fine
def test_for_failure(self, flask_client: Client, user_headers):
r = flask_client.get(f'/api/v1/users/', headers=user_headers)
assert b'failure' in r.data
class TestUserAdd:
def test_for_success(self, flask_client: Client, admin_headers):
r = flask_client.post(f'/api/v1/users/', headers=admin_headers, json={
@ -36,3 +50,19 @@ class TestUserDelete:
assert b'failure' in r.data
class TestUserPatch:
def test_for_success(self, flask_client: Client, admin_headers):
r = flask_client.patch(f'/api/v1/users/admin@admin.com', headers=admin_headers, json={
'username': 'admin_patched'
})
assert b'success' in r.data
# FIXME AssertionError in flask_client at line 63. Il test non riesce ad andare a buon fine
def test_for_failure(self, flask_client: Client, user_headers):
r = flask_client.patch(f'/api/v1/users/admin@admin.com', headers=user_headers, json={
'username': 'admin_patched'
})
assert b'failure' in r.data