This commit is contained in:
jze9
2026-07-21 16:11:09 +05:00
commit 78862296c4
94 changed files with 6090 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
from httpx import AsyncClient
from app.models.user import User
async def test_login_success(client: AsyncClient, admin_user: User) -> None:
res = await client.post(
"/api/v1/auth/token", data={"username": admin_user.username, "password": "adminpass123"}
)
assert res.status_code == 200
assert res.json()["token_type"] == "bearer"
async def test_login_wrong_password(client: AsyncClient, admin_user: User) -> None:
res = await client.post(
"/api/v1/auth/token", data={"username": admin_user.username, "password": "wrong"}
)
assert res.status_code == 401
async def test_mutation_requires_auth(client: AsyncClient) -> None:
res = await client.post("/api/v1/objects", json={"inventory_number": "X", "name": "X"})
assert res.status_code == 401