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