Files
state-hub/tests/test_cors.py
tegwick 166aedfa8d feat: add workplan aliases and legacy meter
Adds preferred workplan REST/event surfaces, legacy-meter telemetry and weekly review summaries, documentation/dashboard terminology updates, dashboard API loading fixes, and close-out sync for STATE-WP-0052 and STATE-WP-0054.
2026-06-04 08:25:31 +02:00

32 lines
867 B
Python

from __future__ import annotations
async def _preflight(client, origin: str):
return await client.options(
"/state/summary",
headers={
"Origin": origin,
"Access-Control-Request-Method": "GET",
},
)
async def test_dashboard_cors_allows_observable_fallback_ports(client):
for origin in (
"http://localhost:3000",
"http://127.0.0.1:3000",
"http://localhost:3001",
"http://127.0.0.1:3001",
"http://[::1]:3000",
):
response = await _preflight(client, origin)
assert response.status_code == 200
assert response.headers["access-control-allow-origin"] == origin
async def test_dashboard_cors_still_rejects_non_dashboard_ports(client):
response = await _preflight(client, "http://localhost:5173")
assert response.status_code == 400