fix(tests):cover auth transport invariants

This commit is contained in:
Anish Sarkar 2026-06-24 03:55:39 +05:30
parent 62c7efb216
commit 766fa25ea0
3 changed files with 96 additions and 17 deletions

View file

@ -16,9 +16,8 @@ TEST_PASSWORD = "testpassword123"
async def get_auth_token(client: httpx.AsyncClient) -> str:
"""Log in and return a Bearer JWT token, registering the user first if needed."""
response = await client.post(
"/auth/jwt/login",
data={"username": TEST_EMAIL, "password": TEST_PASSWORD},
headers={"Content-Type": "application/x-www-form-urlencoded"},
"/auth/desktop/login",
json={"email": TEST_EMAIL, "password": TEST_PASSWORD},
)
if response.status_code == 200:
return response.json()["access_token"]
@ -32,9 +31,8 @@ async def get_auth_token(client: httpx.AsyncClient) -> str:
)
response = await client.post(
"/auth/jwt/login",
data={"username": TEST_EMAIL, "password": TEST_PASSWORD},
headers={"Content-Type": "application/x-www-form-urlencoded"},
"/auth/desktop/login",
json={"email": TEST_EMAIL, "password": TEST_PASSWORD},
)
assert response.status_code == 200, (
f"Login after registration failed ({response.status_code}): {response.text}"