Add comprehensive tests for playlist service and refactor socket service tests
- Introduced a new test suite for the PlaylistService covering various functionalities including creation, retrieval, updating, and deletion of playlists. - Added tests for handling sounds within playlists, ensuring correct behavior when adding/removing sounds and managing current playlists. - Refactored socket service tests for improved readability by adjusting function signatures. - Cleaned up unnecessary whitespace in sound normalizer and sound scanner tests for consistency. - Enhanced audio utility tests to ensure accurate hash and size calculations, including edge cases for nonexistent files. - Removed redundant blank lines in cookie utility tests for cleaner code.
This commit is contained in:
@@ -103,7 +103,8 @@ async def test_client(test_app) -> AsyncGenerator[AsyncClient, None]:
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
async def authenticated_client(
|
||||
test_app: FastAPI, auth_cookies: dict[str, str],
|
||||
test_app: FastAPI,
|
||||
auth_cookies: dict[str, str],
|
||||
) -> AsyncGenerator[AsyncClient, None]:
|
||||
"""Create a test HTTP client with authentication cookies."""
|
||||
async with AsyncClient(
|
||||
@@ -116,7 +117,8 @@ async def authenticated_client(
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
async def authenticated_admin_client(
|
||||
test_app: FastAPI, admin_cookies: dict[str, str],
|
||||
test_app: FastAPI,
|
||||
admin_cookies: dict[str, str],
|
||||
) -> AsyncGenerator[AsyncClient, None]:
|
||||
"""Create a test HTTP client with admin authentication cookies."""
|
||||
async with AsyncClient(
|
||||
@@ -211,7 +213,8 @@ async def ensure_plans(test_session: AsyncSession) -> tuple[Plan, Plan]:
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
async def test_user(
|
||||
test_session: AsyncSession, ensure_plans: tuple[Plan, Plan],
|
||||
test_session: AsyncSession,
|
||||
ensure_plans: tuple[Plan, Plan],
|
||||
) -> User:
|
||||
"""Create a test user."""
|
||||
user = User(
|
||||
@@ -231,7 +234,8 @@ async def test_user(
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
async def admin_user(
|
||||
test_session: AsyncSession, ensure_plans: tuple[Plan, Plan],
|
||||
test_session: AsyncSession,
|
||||
ensure_plans: tuple[Plan, Plan],
|
||||
) -> User:
|
||||
"""Create a test admin user."""
|
||||
user = User(
|
||||
|
||||
Reference in New Issue
Block a user