Refactor test cases for improved readability and consistency
- Adjusted function signatures in various test files to enhance clarity by aligning parameters. - Updated patching syntax for better readability across test cases. - Improved formatting and spacing in test assertions and mock setups. - Ensured consistent use of async/await patterns in async test functions. - Enhanced comments for better understanding of test intentions.
This commit is contained in:
@@ -32,7 +32,7 @@ async def get_sound_normalizer_service(
|
||||
# SCAN ENDPOINTS
|
||||
@router.post("/scan")
|
||||
async def scan_sounds(
|
||||
current_user: Annotated[User, Depends(get_admin_user)],
|
||||
current_user: Annotated[User, Depends(get_admin_user)], # noqa: ARG001
|
||||
scanner_service: Annotated[SoundScannerService, Depends(get_sound_scanner_service)],
|
||||
) -> dict[str, ScanResults | str]:
|
||||
"""Sync the soundboard directory (add/update/delete sounds). Admin only."""
|
||||
@@ -53,11 +53,11 @@ async def scan_sounds(
|
||||
@router.post("/scan/custom")
|
||||
async def scan_custom_directory(
|
||||
directory: str,
|
||||
current_user: Annotated[User, Depends(get_admin_user)],
|
||||
current_user: Annotated[User, Depends(get_admin_user)], # noqa: ARG001
|
||||
scanner_service: Annotated[SoundScannerService, Depends(get_sound_scanner_service)],
|
||||
sound_type: str = "SDB",
|
||||
) -> dict[str, ScanResults | str]:
|
||||
"""Sync a custom directory with the database (add/update/delete sounds). Admin only."""
|
||||
"""Sync a custom directory with the database. Admin only."""
|
||||
try:
|
||||
results = await scanner_service.scan_directory(directory, sound_type)
|
||||
except ValueError as e:
|
||||
@@ -80,14 +80,15 @@ async def scan_custom_directory(
|
||||
# NORMALIZE ENDPOINTS
|
||||
@router.post("/normalize/all")
|
||||
async def normalize_all_sounds(
|
||||
current_user: Annotated[User, Depends(get_admin_user)],
|
||||
current_user: Annotated[User, Depends(get_admin_user)], # noqa: ARG001
|
||||
normalizer_service: Annotated[
|
||||
SoundNormalizerService,
|
||||
Depends(get_sound_normalizer_service),
|
||||
],
|
||||
*,
|
||||
force: Annotated[
|
||||
bool,
|
||||
Query( # noqa: FBT002
|
||||
Query(
|
||||
description="Force normalization of already normalized sounds",
|
||||
),
|
||||
] = False,
|
||||
@@ -119,14 +120,15 @@ async def normalize_all_sounds(
|
||||
@router.post("/normalize/type/{sound_type}")
|
||||
async def normalize_sounds_by_type(
|
||||
sound_type: str,
|
||||
current_user: Annotated[User, Depends(get_admin_user)],
|
||||
current_user: Annotated[User, Depends(get_admin_user)], # noqa: ARG001
|
||||
normalizer_service: Annotated[
|
||||
SoundNormalizerService,
|
||||
Depends(get_sound_normalizer_service),
|
||||
],
|
||||
*,
|
||||
force: Annotated[
|
||||
bool,
|
||||
Query( # noqa: FBT002
|
||||
Query(
|
||||
description="Force normalization of already normalized sounds",
|
||||
),
|
||||
] = False,
|
||||
@@ -167,14 +169,15 @@ async def normalize_sounds_by_type(
|
||||
@router.post("/normalize/{sound_id}")
|
||||
async def normalize_sound_by_id(
|
||||
sound_id: int,
|
||||
current_user: Annotated[User, Depends(get_admin_user)],
|
||||
current_user: Annotated[User, Depends(get_admin_user)], # noqa: ARG001
|
||||
normalizer_service: Annotated[
|
||||
SoundNormalizerService,
|
||||
Depends(get_sound_normalizer_service),
|
||||
],
|
||||
*,
|
||||
force: Annotated[
|
||||
bool,
|
||||
Query( # noqa: FBT002
|
||||
Query(
|
||||
description="Force normalization of already normalized sound",
|
||||
),
|
||||
] = False,
|
||||
|
||||
Reference in New Issue
Block a user