Refactor sound and extraction services to include user and timestamp fields
- Updated ExtractionInfo to include user_id, created_at, and updated_at fields. - Modified ExtractionService to return user and timestamp information in extraction responses. - Enhanced sound serialization in PlayerState to include extraction URL if available. - Adjusted PlaylistRepository to load sound extractions when retrieving playlist sounds. - Added tests for new fields in extraction and sound endpoints, ensuring proper response structure. - Created new test file endpoints for sound downloads and thumbnail retrievals, including success and error cases. - Refactored various test cases for consistency and clarity, ensuring proper mocking and assertions.
This commit is contained in:
@@ -125,7 +125,8 @@ class TestApiTokenEndpoints:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_generate_api_token_unauthenticated(
|
||||
self, client: AsyncClient,
|
||||
self,
|
||||
client: AsyncClient,
|
||||
) -> None:
|
||||
"""Test API token generation without authentication."""
|
||||
response = await client.post(
|
||||
@@ -197,7 +198,8 @@ class TestApiTokenEndpoints:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_api_token_status_unauthenticated(
|
||||
self, client: AsyncClient,
|
||||
self,
|
||||
client: AsyncClient,
|
||||
) -> None:
|
||||
"""Test getting API token status without authentication."""
|
||||
response = await client.get("/api/v1/auth/api-token/status")
|
||||
@@ -277,7 +279,8 @@ class TestApiTokenEndpoints:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_api_token_authentication_invalid_token(
|
||||
self, client: AsyncClient,
|
||||
self,
|
||||
client: AsyncClient,
|
||||
) -> None:
|
||||
"""Test authentication with invalid API token."""
|
||||
headers = {"API-TOKEN": "invalid_token"}
|
||||
@@ -312,7 +315,8 @@ class TestApiTokenEndpoints:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_api_token_authentication_empty_token(
|
||||
self, client: AsyncClient,
|
||||
self,
|
||||
client: AsyncClient,
|
||||
) -> None:
|
||||
"""Test authentication with empty API-TOKEN header."""
|
||||
# Empty token
|
||||
|
||||
Reference in New Issue
Block a user