refactor: Create admin enpoints and some renaming of api endpoints
This commit is contained in:
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user