Refactor user endpoint tests to include pagination and response structure validation
- Updated tests for listing users to validate pagination and response format. - Changed mock return values to include total count and pagination details. - Refactored user creation mocks for clarity and consistency. - Enhanced assertions to check for presence of pagination fields in responses. - Adjusted test cases for user retrieval and updates to ensure proper handling of user data. - Improved readability by restructuring mock definitions and assertions across various test files.
This commit is contained in:
@@ -39,14 +39,19 @@ class PlaylistResponse(BaseModel):
|
||||
updated_at: str | None
|
||||
|
||||
@classmethod
|
||||
def from_playlist(cls, playlist: Playlist, is_favorited: bool = False, favorite_count: int = 0) -> "PlaylistResponse":
|
||||
def from_playlist(
|
||||
cls,
|
||||
playlist: Playlist,
|
||||
is_favorited: bool = False, # noqa: FBT001, FBT002
|
||||
favorite_count: int = 0,
|
||||
) -> "PlaylistResponse":
|
||||
"""Create response from playlist model.
|
||||
|
||||
|
||||
Args:
|
||||
playlist: The Playlist model
|
||||
is_favorited: Whether the playlist is favorited by the current user
|
||||
favorite_count: Number of users who favorited this playlist
|
||||
|
||||
|
||||
Returns:
|
||||
PlaylistResponse instance
|
||||
|
||||
|
||||
Reference in New Issue
Block a user