feat: Add audio extraction endpoints and refactor sound API routes

This commit is contained in:
JSC
2025-08-01 21:39:42 +02:00
parent 6068599a47
commit d2d0240fdb
9 changed files with 150 additions and 124 deletions

View File

@@ -18,7 +18,7 @@ class TestExtractionEndpoints:
test_client.cookies.update(auth_cookies)
response = await test_client.post(
"/api/v1/sounds/extract",
"/api/v1/extractions/",
params={"url": "https://www.youtube.com/watch?v=test"},
)
@@ -32,7 +32,7 @@ class TestExtractionEndpoints:
) -> None:
"""Test extraction creation without authentication."""
response = await test_client.post(
"/api/v1/sounds/extract",
"/api/v1/extractions/",
params={"url": "https://www.youtube.com/watch?v=test"},
)
@@ -44,7 +44,7 @@ class TestExtractionEndpoints:
self, test_client: AsyncClient,
) -> None:
"""Test extraction retrieval without authentication."""
response = await test_client.get("/api/v1/sounds/extract/1")
response = await test_client.get("/api/v1/extractions/1")
# Should return 401 for missing authentication
assert response.status_code == 401
@@ -60,7 +60,7 @@ class TestExtractionEndpoints:
test_client.cookies.update(admin_cookies)
# The new admin endpoint should work
response = await test_client.get("/api/v1/admin/sounds/extract/status")
response = await test_client.get("/api/v1/admin/extractions/status")
assert response.status_code == 200
data = response.json()
assert "running" in data or "is_running" in data
@@ -76,7 +76,7 @@ class TestExtractionEndpoints:
# Set cookies on client instance to avoid deprecation warning
test_client.cookies.update(auth_cookies)
response = await test_client.get("/api/v1/sounds/extract")
response = await test_client.get("/api/v1/extractions/")
# Should succeed and return empty list (no extractions in test DB)
assert response.status_code == 200