refactor: Create admin enpoints and some renaming of api endpoints

This commit is contained in:
JSC
2025-08-01 15:34:35 +02:00
parent 43be92c8f9
commit 3132175354
9 changed files with 999 additions and 1269 deletions

View File

@@ -45,35 +45,20 @@ class TestExtractionEndpoints:
assert response.status_code == 401
@pytest.mark.asyncio
async def test_get_processor_status_admin(
async def test_get_processor_status_moved_to_admin(
self, test_client: AsyncClient, admin_cookies: dict[str, str],
) -> None:
"""Test getting processor status as admin."""
"""Test that processor status endpoint was moved to admin."""
# Set cookies on client instance to avoid deprecation warning
test_client.cookies.update(admin_cookies)
response = await test_client.get("/api/v1/sounds/extract/status")
# Should succeed for admin users
# The new admin endpoint should work
response = await test_client.get("/api/v1/admin/sounds/extract/status")
assert response.status_code == 200
data = response.json()
assert "running" in data
assert "running" in data or "is_running" in data
assert "max_concurrent" in data
@pytest.mark.asyncio
async def test_get_processor_status_non_admin(
self, test_client: AsyncClient, auth_cookies: dict[str, str],
) -> None:
"""Test getting processor status as non-admin user."""
# Set cookies on client instance to avoid deprecation warning
test_client.cookies.update(auth_cookies)
response = await test_client.get("/api/v1/sounds/extract/status")
# Should return 403 for non-admin users
assert response.status_code == 403
assert "Only administrators" in response.json()["detail"]
@pytest.mark.asyncio
async def test_get_user_extractions(
self, test_client: AsyncClient, auth_cookies: dict[str, str],