feat(core): persist viewer state and integrate Cesium services and profiles
This commit is contained in:
@@ -126,3 +126,34 @@ def test_api_cross_browser_read_and_stale_write(tmp_path):
|
||||
== 403
|
||||
)
|
||||
assert a.get(url, headers={"Sec-Fetch-Site": "cross-site"}).status_code == 403
|
||||
|
||||
|
||||
def test_observation_views_survive_new_clients_without_browser_storage(tmp_path):
|
||||
camera = dict(longitude=37, latitude=55, height=600, heading=137, pitch=-28, roll=3)
|
||||
document = {"schema": "missioncore.observation-map/v1", "camera": camera,
|
||||
"layers": dict(imagery=True, terrain=True, buildings=False,
|
||||
grid=False, targets=True)}
|
||||
a = client(tmp_path)
|
||||
url = "/api/v1/scene-profiles/observation-map?owner=rover-006"
|
||||
assert a.put(url, json={"document": document, "expected_revision": 0}).status_code == 200
|
||||
assert client(tmp_path).get(url).json()["document"] == document
|
||||
assert client(tmp_path).get(url.replace("rover-006", "other")).json()["document"] is None
|
||||
model = {"schema": "missioncore.rover-view/v1", "model": "dcd006-v022"}
|
||||
url = "/api/v1/scene-profiles/rover-view?owner=rover-006"
|
||||
assert a.put(url, json={"document": model, "expected_revision": 0}).status_code == 200
|
||||
assert client(tmp_path).get(url).json()["document"] == model
|
||||
model["armed"] = True
|
||||
assert a.put(url, json={"document": model, "expected_revision": 1}).status_code == 422
|
||||
|
||||
|
||||
@pytest.mark.parametrize("field,value", [("pitch", -100), ("height", True),
|
||||
("longitude", 200), ("heading", "30")])
|
||||
def test_observation_map_rejects_bad_pose(tmp_path, field, value):
|
||||
camera = dict(longitude=37, latitude=55, height=600, heading=137, pitch=-28, roll=3)
|
||||
camera[field] = value
|
||||
document = {"schema": "missioncore.observation-map/v1", "camera": camera,
|
||||
"layers": dict(imagery=True, terrain=True, buildings=False,
|
||||
grid=False, targets=True)}
|
||||
with pytest.raises(ValueError):
|
||||
SceneProfileStore(tmp_path).save("observation-map", "rover", document, 0)
|
||||
assert not SceneProfileStore(tmp_path).path("observation-map", "rover").exists()
|
||||
|
||||
Reference in New Issue
Block a user