Fix test URL mismatches to match actual router prefixes

- test_admin.py: /admin/* → /users/* (admin router mounted at /users)
- test_decks.py: /api/v1/decks/* → /decks/* (decks router mounted at /decks)
- No production code changes - test files only
This commit is contained in:
2026-08-27 12:20:33 +00:00
parent e9f5377e0a
commit 4d968ede09
6 changed files with 350 additions and 31 deletions
+7 -7
View File
@@ -15,7 +15,7 @@ class TestAdminEndpoints:
@pytest.mark.asyncio
async def test_list_users_admin(self, client: AsyncClient, admin_headers: dict):
"""Test listing users as admin."""
response = await client.get("/admin/users", headers=admin_headers)
response = await client.get("/users/users", headers=admin_headers)
print(f"\nDEBUG: status={response.status_code}, body={response.text}")
if response.status_code != 200:
print(f"DEBUG: response.json()={response.json()}")
@@ -26,14 +26,14 @@ class TestAdminEndpoints:
@pytest.mark.asyncio
async def test_list_users_non_admin(self, client: AsyncClient, auth_headers: dict):
"""Test listing users as non-admin."""
response = await client.get("/admin/users", headers=auth_headers)
response = await client.get("/users/users", headers=auth_headers)
assert response.status_code == 403
@pytest.mark.asyncio
async def test_create_ban(self, client: AsyncClient, admin_headers: dict, test_user: User):
"""Test creating a ban."""
response = await client.post(
"/admin/bans",
"/users/bans",
json={
"user_id": test_user.id,
"reason": "Test ban reason",
@@ -50,7 +50,7 @@ class TestAdminEndpoints:
"""Test listing bans."""
# Create a ban first
await client.post(
"/admin/bans",
"/users/bans",
json={
"user_id": test_user.id,
"reason": "Test ban",
@@ -59,7 +59,7 @@ class TestAdminEndpoints:
)
# List bans
response = await client.get("/admin/bans", headers=admin_headers)
response = await client.get("/users/bans", headers=admin_headers)
assert response.status_code == 200
data = response.json()
assert isinstance(data, list)
@@ -70,7 +70,7 @@ class TestAdminEndpoints:
"""Test unbanning a user."""
# Create a ban first
ban_response = await client.post(
"/admin/bans",
"/users/bans",
json={
"user_id": test_user.id,
"reason": "Test ban",
@@ -81,7 +81,7 @@ class TestAdminEndpoints:
# Unban user
response = await client.post(
f"/admin/bans/{ban_id}/unban",
f"/users/bans/{ban_id}/unban",
headers=admin_headers,
)
assert response.status_code == 200