osint-dashboard/tests/test_geofence_frontend.py
Sirius DevOps 8c97ce50d2 feat(map): geofence watch HUD — finish/cancel, inbox, fence DVR
Phone can finish a polygon without double-click. List is mute/go/rename/delete.
Inbox seeds from /api/geofence-alerts and appends WS hits. Watch all fence
ids on /ws/live. Selected-fence DVR uses GET /api/geofences/{id}/at.
2026-09-01 01:36:21 -04:00

56 lines
1.6 KiB
Python

"""Geofence layer panel: draw, watch, inbox, delete (HTML contract)."""
from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
HTML = (ROOT / "app/static/index.html").read_text()
def test_geofence_panel_has_list_and_delete_hook():
assert 'id="gf-draw"' in HTML
assert 'id="gf-list"' in HTML
assert "function deleteGeofence" in HTML
assert "method: 'DELETE'" in HTML or 'method: "DELETE"' in HTML
assert "/api/geofences/" in HTML
def test_load_geofences_renders_delete_controls():
js = HTML.split("async function loadGeofences", 1)[1].split(
"async function loadFireAircraftHits", 1
)[0]
assert "gf-list" in js
assert "deleteGeofence" in js
assert "onEachFeature" in js
assert "bindPopup" in js
def test_finish_cancel_draw_controls():
assert 'id="gf-finish"' in HTML
assert 'id="gf-cancel"' in HTML
assert "function cancelGeofenceDraw" in HTML
assert "function onGfClose" in HTML
def test_watch_geofences_ws_payload():
assert "watch_geofences" in HTML
assert "function sendWatchGeofences" in HTML
def test_geofence_alert_inbox():
assert 'id="gf-inbox"' in HTML
assert "/api/geofence-alerts" in HTML
assert "function loadGfInbox" in HTML
assert "function pushGfInbox" in HTML
def test_delete_geofence_still_present():
assert "function deleteGeofence" in HTML
assert "method: 'DELETE'" in HTML or 'method: "DELETE"' in HTML
def test_fence_dvr_at_endpoint():
assert "/at?timestamp=" in HTML or "/at?timestamp=${" in HTML
assert "function dvrScrubFence" in HTML
assert "gfSelectedId" in HTML