diff --git a/tests/test_api_admin.py b/tests/test_api_admin.py index 4869e22..ce303ac 100644 --- a/tests/test_api_admin.py +++ b/tests/test_api_admin.py @@ -117,11 +117,11 @@ async def test_bulk_delete_dry_run_returns_counts(client, db, tmp_path): await db.flush() i1 = ImageRecord( artist_id=a.id, path=str(tmp_path / "1.jpg"), - sha256="1" * 64, size_bytes=10, + sha256="1" * 64, size_bytes=10, mime="image/jpeg", ) i2 = ImageRecord( artist_id=a.id, path=str(tmp_path / "2.jpg"), - sha256="2" * 64, size_bytes=20, + sha256="2" * 64, size_bytes=20, mime="image/jpeg", ) db.add_all([i1, i2]) await db.commit() @@ -169,7 +169,7 @@ async def test_bulk_delete_wrong_confirm_400_with_expected_token( await db.flush() img = ImageRecord( artist_id=a.id, path=str(tmp_path / "x.jpg"), - sha256="c" * 64, size_bytes=10, + sha256="c" * 64, size_bytes=10, mime="image/jpeg", ) db.add(img) await db.commit() @@ -196,7 +196,7 @@ async def test_bulk_delete_correct_confirm_dispatches( await db.flush() img = ImageRecord( artist_id=a.id, path=str(tmp_path / "x.jpg"), - sha256="d" * 64, size_bytes=10, + sha256="d" * 64, size_bytes=10, mime="image/jpeg", ) db.add(img) await db.commit() @@ -323,7 +323,7 @@ async def test_prune_unused_dry_run_lists_unused(client, db, tmp_path): await db.flush() img = ImageRecord( artist_id=a.id, path=str(tmp_path / "p.jpg"), - sha256="e" * 64, size_bytes=10, + sha256="e" * 64, size_bytes=10, mime="image/jpeg", ) db.add(img) used = Tag(name="kept", kind=TagKind.general) diff --git a/tests/test_cleanup_service.py b/tests/test_cleanup_service.py index df632fa..f40113a 100644 --- a/tests/test_cleanup_service.py +++ b/tests/test_cleanup_service.py @@ -21,6 +21,7 @@ def _make_image(db_sync, *, artist, path, sha256, size=1000, thumb=None): path=path, sha256=sha256, size_bytes=size, + mime="image/jpeg", thumbnail_path=thumb, ) db_sync.add(img) diff --git a/tests/test_tasks_admin.py b/tests/test_tasks_admin.py index da38e2b..332cdd1 100644 --- a/tests/test_tasks_admin.py +++ b/tests/test_tasks_admin.py @@ -4,10 +4,10 @@ task_always_eager + signal handlers from FC-3i populate task_run. We assert the wrapper passes args through correctly and that task_run lifecycle status flips as expected. """ -import backend.app.tasks.admin # noqa: F401 — register tasks import pytest from sqlalchemy import func, select +import backend.app.tasks.admin # noqa: F401 — register tasks from backend.app.celery_app import celery from backend.app.models import Artist, ImageRecord, TaskRun @@ -59,7 +59,7 @@ async def test_delete_artist_cascade_task_removes_artist_and_records_ok( f.write_bytes(b"x") db_sync.add(ImageRecord( artist_id=a.id, path=str(f), - sha256=f"{i:064x}", size_bytes=10, + sha256=f"{i:064x}", size_bytes=10, mime="image/jpeg", )) db_sync.commit() artist_id = a.id @@ -122,7 +122,7 @@ async def test_bulk_delete_images_task_removes_listed_images( f.write_bytes(b"x") img = ImageRecord( artist_id=a.id, path=str(f), - sha256=f"a{i:063x}", size_bytes=10, + sha256=f"a{i:063x}", size_bytes=10, mime="image/jpeg", ) db_sync.add(img) db_sync.flush()