feat(phash): import_settings.phash_threshold (migration 0006) exposed + validated in API

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-17 22:04:13 -04:00
parent d2e8dd3a3b
commit 9ef5e5047d
4 changed files with 67 additions and 0 deletions
+24
View File
@@ -47,6 +47,30 @@ async def test_patch_rejects_non_object(client):
assert resp.status_code == 400
@pytest.mark.asyncio
async def test_import_settings_phash_threshold_default(client):
resp = await client.get("/api/settings/import")
assert resp.status_code == 200
assert (await resp.get_json())["phash_threshold"] == 10
@pytest.mark.asyncio
async def test_patch_phash_threshold(client):
resp = await client.patch(
"/api/settings/import", json={"phash_threshold": 4}
)
assert resp.status_code == 200
assert (await resp.get_json())["phash_threshold"] == 4
@pytest.mark.asyncio
async def test_patch_phash_threshold_rejects_negative(client):
resp = await client.patch(
"/api/settings/import", json={"phash_threshold": -1}
)
assert resp.status_code == 400
@pytest.mark.asyncio
async def test_system_stats_shape(client):
resp = await client.get("/api/system/stats")