test form data for POST

This commit is contained in:
Jakub Miazek
2024-11-11 15:10:05 +01:00
parent 51c20c28eb
commit 34ab82fb4c
4 changed files with 20 additions and 4 deletions

View File

@@ -38,7 +38,11 @@ async def test_add_user(client: AsyncClient):
# TODO: parametrize test with diff urls including 404 and 401
async def test_get_token(client: AsyncClient):
payload = {"email": "joe@grillazz.com", "password": "s1lly"}
response = await client.post("/user/token", json=payload)
response = await client.post(
"/user/token",
data=payload,
headers={"Content-Type": "application/x-www-form-urlencoded"},
)
assert response.status_code == status.HTTP_201_CREATED
claimset = jwt.decode(
response.json()["access_token"], options={"verify_signature": False}