Expand server test coverage from 66% to 73%

Add comprehensive tests for:
- Download routes helper functions (_format_size, _get_output_dir, _resolve_version_id)
- Background download task execution (success, failure, exception handling)
- Progress callback with different sizes (bytes, KB, MB, GB)
- Auto-linking downloaded files to CivitAI
- Database file lookup and linking with CivitAI matches
- CivitAI cache failure handling
- Gallery edge cases and metadata operations
- Server initialization and OpenAPI schema

Server module coverage now:
- auth.py: 100%
- civitai_routes.py: 98%
- db_routes.py: 97%
- download_routes.py: 98%
- gallery_routes.py: 98%
- gallery.py: 95%

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Adam Ladachowski
2026-02-15 19:11:25 +01:00
parent a68ab90025
commit e4fc392a90
2 changed files with 1348 additions and 1 deletions
+1347
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -230,7 +230,7 @@ class TestEnums:
assert BaseModel.sd15.to_api() == "SD 1.5"
assert BaseModel.sdxl.to_api() == "SDXL 1.0"
assert BaseModel.pony.to_api() == "Pony"
assert BaseModel.flux.to_api() == "Flux.1 D"
assert BaseModel.flux_dev.to_api() == "Flux.1 D"
assert BaseModel.illustrious.to_api() == "Illustrious"
def test_sort_order_to_api(self) -> None: