Files
Sheerka/tests/server/test_server.py
kodjo e41094f908 Fixed #8
Fixed #12
Fixed #13
Fixed #14
2023-05-08 17:50:28 +02:00

20 lines
466 B
Python

from starlette.testclient import TestClient
from server.main import app
client = TestClient(app)
def test_i_can_authenticate():
data = {
"username": "kodjo",
"password": "kodjo"
}
response = client.post("/token", data=data)
assert response.status_code == 200
as_json = response.json()
assert 'access_token' in as_json
assert 'first_name' in as_json
assert 'last_name' in as_json
assert 'token_type' in as_json