from fastapi.testclient import TestClient from adcloud_server.main import app client = TestClient(app) def test_health(): response = client.get("/health") assert response.status_code == 200 assert response.json() == {"status": "ok"} def test_local_frontend_cors(): response = client.get("/health", headers={"Origin": "http://localhost:5173"}) assert response.headers["access-control-allow-origin"] == "http://localhost:5173" def test_unknown_origin_not_allowed(): response = client.get("/health", headers={"Origin": "https://unknown.example"}) assert "access-control-allow-origin" not in response.headers