mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
test form data for POST
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user