Files
geointel/backend/tests/test_sprint122_model_asset_activation_guardrails.py
T
Codex b5bcd9b041
GeoIntel CI / docs-smoke (push) Canceled after 0s
GeoIntel CI / contract-smoke (push) Canceled after 0s
feat: simplify regional end user workbench
2026-07-14 21:40:32 +02:00

39 lines
1.6 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 = (ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(
encoding="utf-8"
)
assert "Lokaal modelbestand" in lab
assert "GeoIntel kiest automatisch het actieve lokale model" in lab
assert "Gevalideerde 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 = (ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(
encoding="utf-8"
)
assert "detectionHasExplicitModelAsset" in lab
assert "Kies een lokaal modelbestand onder beheer" in lab
assert "Lokale modelkeuze" in lab