feat(workbench): add runtime GIS and sample integrations
This commit is contained in:
@@ -44,3 +44,34 @@ def test_project_workspace_sets_30_day_client_cache(monkeypatch):
|
||||
|
||||
assert layers == geoserver_client.PROJECT_LAYER_NAMES
|
||||
assert cache_updates == ["2592000"] * len(layers)
|
||||
|
||||
|
||||
def test_publish_feature_type_updates_existing_layer_and_cache(monkeypatch):
|
||||
requests: list[tuple[str, str]] = []
|
||||
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
requests.append((request.method, request.url.path))
|
||||
if request.method == "GET" and request.url.path.endswith("/featuretypes/demo_layer.json"):
|
||||
return httpx.Response(200, json={"featureType": {"name": "demo_layer"}})
|
||||
if request.method == "GET" and "/gwc/rest/layers/" in request.url.path:
|
||||
return httpx.Response(200, content=b"<GeoServerLayer><name>demo</name></GeoServerLayer>")
|
||||
return httpx.Response(200)
|
||||
|
||||
monkeypatch.setattr(geoserver_client.settings, "GEOSERVER_USERNAME", "admin")
|
||||
monkeypatch.setattr(geoserver_client.settings, "GEOSERVER_PASSWORD", "secret")
|
||||
monkeypatch.setattr(geoserver_client.settings, "GEOSERVER_CLIENT_CACHE_SECONDS", 2_592_000)
|
||||
http_client = httpx.Client(
|
||||
base_url="http://geoserver.example/geoserver",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
geoserver_client.GeoServerAdminClient(client=http_client).publish_feature_type(
|
||||
workspace="demo",
|
||||
datastore="demo",
|
||||
layer="demo_layer",
|
||||
title="Demo layer",
|
||||
map_bbox=(1.0, 2.0, 3.0, 4.0),
|
||||
)
|
||||
|
||||
assert ("PUT", "/geoserver/rest/workspaces/demo/datastores/demo/featuretypes/demo_layer") in requests
|
||||
assert ("PUT", "/geoserver/gwc/rest/layers/demo:demo_layer.xml") in requests
|
||||
|
||||
Reference in New Issue
Block a user