fix(fc3k): add mime=image/jpeg to test ImageRecord ctors (NOT NULL) + reorder admin import after stdlib/3rd-party (ruff I001)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user