45 lines
1.9 KiB
Python
45 lines
1.9 KiB
Python
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_detection_workflow_selects_only_the_active_runtime_model_asset_automatically() -> None:
|
|
hook = (ROOT / "frontend" / "src" / "hooks" / "useDetectionWorkflow.ts").read_text(encoding="utf-8")
|
|
|
|
assert "const activeAsset = assetResponse.items.find((asset) => asset.active) ?? null" in hook
|
|
assert "const selectedAssetStillAvailable" in hook
|
|
assert "activeAsset?.model_asset_id ?? ''" in hook
|
|
assert "setSelectedModelAssetId(nextAssetId)" in hook
|
|
assert "setSelectedModelAssetId(assetResponse.items[0]" not in hook
|
|
assert "getYoloPreflight({ model_asset_id: nextAssetId || null })" in hook
|
|
|
|
|
|
def test_detection_lab_explains_explicit_model_asset_and_threshold_selection() -> None:
|
|
lab = "\n".join(
|
|
(
|
|
(ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(encoding="utf-8"),
|
|
(ROOT / "frontend" / "src" / "components" / "detection" / "DetectionModelManagement.tsx").read_text(encoding="utf-8"),
|
|
)
|
|
)
|
|
|
|
assert "Lokaal modelbestand" in lab
|
|
assert "GeoIntel kiest automatisch het actieve lokale model" in lab
|
|
assert "Gevalideerde YOLO-profielen" in lab
|
|
assert "DETECTION_OPERATOR_PROFILES" in lab
|
|
assert "kandidaat, extra controle vereist" in lab
|
|
assert "will_download_models" in lab
|
|
|
|
|
|
def test_detection_run_readiness_requires_explicit_asset_when_local_assets_exist() -> None:
|
|
lab = "\n".join(
|
|
(
|
|
(ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(encoding="utf-8"),
|
|
(ROOT / "frontend" / "src" / "components" / "detection" / "DetectionModelManagement.tsx").read_text(encoding="utf-8"),
|
|
)
|
|
)
|
|
|
|
assert "detectionHasExplicitModelAsset" in lab
|
|
assert "Kies een lokaal modelbestand onder beheer" in lab
|
|
assert "Lokale modelkeuze" in lab
|