Files
geointel/backend/tests/test_sprint122_model_asset_activation_guardrails.py
T
Jens faeb58ef6d
GeoIntel release gates / Compile, test, contracts and builds (push) Successful in 1m49s
GeoIntel release gates / Python and npm vulnerability policy (push) Successful in 21s
GeoIntel release gates / Production AI image, SBOM and container scan (push) Successful in 5m39s
GeoIntel release gates / Deploy exact gated revision to Unraid (push) Failing after 58m43s
Initial public release
2026-08-31 21:56:53 +02:00

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 "Historische YOLO-controleprofielen" in lab
assert "DETECTION_OPERATOR_PROFILES" in lab
assert "historisch, geen releasebewijs" 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