Initialize uv-managed FastAPI backend
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from backend_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
|
||||
Reference in New Issue
Block a user