27 lines
804 B
Python
27 lines
804 B
Python
|
|
"""Geofence layer panel: draw + delete (DELETE /api/geofences/{id})."""
|
||
|
|
|
||
|
|
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
|