fix: improve test isolation and configuration

- Use in-memory SQLite for tests to prevent conflicts
- Add try/finally for robust test cleanup
- Make database URL configurable via env var
- Make CORS origins configurable via env var
- Make SQL echo configurable via env var
This commit is contained in:
2026-05-11 21:25:35 +02:00
parent 878e303cc6
commit 55ba9b62d6
3 changed files with 17 additions and 14 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
import os
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from contextlib import asynccontextmanager
@@ -18,7 +19,7 @@ app = FastAPI(
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000"],
allow_origins=os.environ.get("CORS_ORIGINS", "http://localhost:3000").split(","),
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],