Files
geointel/backend/tests/test_sprint118_yolo_preflight_ui.py
T
Codex 6e2a8cbdc4
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled
Add local model asset catalog
2026-07-06 20:59:03 +02:00

52 lines
2.3 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def test_detection_lab_surfaces_yolo_runtime_preflight() -> None:
lab = (ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(
encoding="utf-8"
)
hook = (ROOT / "frontend" / "src" / "hooks" / "useDetectionWorkflow.ts").read_text(encoding="utf-8")
api = (ROOT / "frontend" / "src" / "services" / "api" / "detection.ts").read_text(encoding="utf-8")
types = (ROOT / "frontend" / "src" / "types.ts").read_text(encoding="utf-8")
app = (ROOT / "frontend" / "src" / "App.tsx").read_text(encoding="utf-8")
assert "YOLO runtime preflight" in lab
assert "torch_version" in lab
assert "ultralytics_version" in lab
assert "cuda_available" in lab
assert "onRefreshYoloPreflight" in lab
assert "loadYoloPreflight" in hook
assert "getYoloPreflight" in api
assert "/api/v1/detection/yolo/preflight" in api
assert "interface YoloPreflightResponse" in types
assert "yoloPreflight={yoloPreflight}" in app
def test_detection_lab_surfaces_local_model_asset_selection() -> None:
lab = (ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(
encoding="utf-8"
)
hook = (ROOT / "frontend" / "src" / "hooks" / "useDetectionWorkflow.ts").read_text(encoding="utf-8")
api = (ROOT / "frontend" / "src" / "services" / "api" / "detection.ts").read_text(encoding="utf-8")
types = (ROOT / "frontend" / "src" / "types.ts").read_text(encoding="utf-8")
app = (ROOT / "frontend" / "src" / "App.tsx").read_text(encoding="utf-8")
provider_panel = (ROOT / "frontend" / "src" / "components" / "providers" / "ProviderPanel.tsx").read_text(
encoding="utf-8"
)
assert "interface ModelAssetRead" in types
assert "model_asset_id?: string | null" in types
assert "listModelAssets" in api
assert "/api/v1/detection/model-assets" in api
assert "modelAssets" in hook
assert "selectedModelAssetId" in hook
assert "model_asset_id: selectedModelAssetId || null" in hook
assert "Local model assets" in lab
assert "onSelectModelAsset" in lab
assert "modelAssets={modelAssets}" in app
assert "Official reference sources" in provider_panel
assert "not AI model choices" in provider_panel