feat(map): adopt DC Default scene
This commit is contained in:
+19
-1
@@ -13,6 +13,7 @@ from fastapi.routing import APIRoute
|
||||
|
||||
from k1link.web.map_api import (
|
||||
MAP_GATEWAY_URL_ENV,
|
||||
MAP_SANDBOX_HIDE_CREDITS_ENV,
|
||||
MapGatewayConfiguration,
|
||||
MapGatewayProxy,
|
||||
build_map_router,
|
||||
@@ -108,7 +109,10 @@ def test_configuration_is_fail_closed_and_rejects_non_origin_values(
|
||||
MapGatewayConfiguration.from_environment()
|
||||
|
||||
|
||||
def test_runtime_config_exposes_only_same_origin_contract_and_hides_internal_origin() -> None:
|
||||
def test_runtime_config_exposes_only_same_origin_contract_and_hides_internal_origin(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
monkeypatch.delenv(MAP_SANDBOX_HIDE_CREDITS_ENV, raising=False)
|
||||
service, requests = _service(
|
||||
lambda request: httpx.Response(
|
||||
200,
|
||||
@@ -133,11 +137,25 @@ def test_runtime_config_exposes_only_same_origin_contract_and_hides_internal_ori
|
||||
"terrain": 1,
|
||||
"buildings": 96188,
|
||||
}
|
||||
assert document["sandbox"] == {"hide_credit_overlay": False}
|
||||
assert response.headers["cache-control"] == "no-store"
|
||||
assert not requests
|
||||
assert "map-gateway.internal" not in _response_body(response).decode()
|
||||
|
||||
|
||||
def test_runtime_config_hides_credits_only_with_explicit_sandbox_flag(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
service, _ = _service(lambda request: httpx.Response(200))
|
||||
monkeypatch.setenv(MAP_SANDBOX_HIDE_CREDITS_ENV, "true")
|
||||
|
||||
response = service.runtime_configuration()
|
||||
|
||||
assert isinstance(response, JSONResponse)
|
||||
document = json.loads(_response_body(response))
|
||||
assert document["sandbox"] == {"hide_credit_overlay": True}
|
||||
|
||||
|
||||
def test_runtime_config_is_fail_closed_when_gateway_is_not_configured() -> None:
|
||||
service = MapGatewayProxy(MapGatewayConfiguration(None))
|
||||
response = service.runtime_configuration()
|
||||
|
||||
Reference in New Issue
Block a user