Refactor test files for improved readability and consistency
- Removed unnecessary blank lines and adjusted formatting in test files. - Ensured consistent use of commas in function calls and assertions across various test cases. - Updated import statements for better organization and clarity. - Enhanced mock setups in tests for better isolation and reliability. - Improved assertions to follow a consistent style for better readability.
This commit is contained in:
@@ -49,7 +49,7 @@ class PlaylistService:
|
||||
if not main_playlist:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail="Main playlist not found. Make sure to run database seeding."
|
||||
detail="Main playlist not found. Make sure to run database seeding.",
|
||||
)
|
||||
|
||||
return main_playlist
|
||||
@@ -179,7 +179,7 @@ class PlaylistService:
|
||||
return await self.playlist_repo.get_playlist_sounds(playlist_id)
|
||||
|
||||
async def add_sound_to_playlist(
|
||||
self, playlist_id: int, sound_id: int, user_id: int, position: int | None = None
|
||||
self, playlist_id: int, sound_id: int, user_id: int, position: int | None = None,
|
||||
) -> None:
|
||||
"""Add a sound to a playlist."""
|
||||
# Verify playlist exists
|
||||
@@ -202,11 +202,11 @@ class PlaylistService:
|
||||
|
||||
await self.playlist_repo.add_sound_to_playlist(playlist_id, sound_id, position)
|
||||
logger.info(
|
||||
"Added sound %s to playlist %s for user %s", sound_id, playlist_id, user_id
|
||||
"Added sound %s to playlist %s for user %s", sound_id, playlist_id, user_id,
|
||||
)
|
||||
|
||||
async def remove_sound_from_playlist(
|
||||
self, playlist_id: int, sound_id: int, user_id: int
|
||||
self, playlist_id: int, sound_id: int, user_id: int,
|
||||
) -> None:
|
||||
"""Remove a sound from a playlist."""
|
||||
# Verify playlist exists
|
||||
@@ -228,7 +228,7 @@ class PlaylistService:
|
||||
)
|
||||
|
||||
async def reorder_playlist_sounds(
|
||||
self, playlist_id: int, user_id: int, sound_positions: list[tuple[int, int]]
|
||||
self, playlist_id: int, user_id: int, sound_positions: list[tuple[int, int]],
|
||||
) -> None:
|
||||
"""Reorder sounds in a playlist."""
|
||||
# Verify playlist exists
|
||||
@@ -262,7 +262,7 @@ class PlaylistService:
|
||||
await self._unset_current_playlist(user_id)
|
||||
await self._set_main_as_current(user_id)
|
||||
logger.info(
|
||||
"Unset current playlist and set main as current for user %s", user_id
|
||||
"Unset current playlist and set main as current for user %s", user_id,
|
||||
)
|
||||
|
||||
async def get_playlist_stats(self, playlist_id: int) -> dict[str, Any]:
|
||||
@@ -290,7 +290,7 @@ class PlaylistService:
|
||||
|
||||
# Check if sound is already in main playlist
|
||||
if not await self.playlist_repo.is_sound_in_playlist(
|
||||
main_playlist.id, sound_id
|
||||
main_playlist.id, sound_id,
|
||||
):
|
||||
await self.playlist_repo.add_sound_to_playlist(main_playlist.id, sound_id)
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user