feat: fastapi-backend mit healthcheck und alembic-basis
- GET /api/health prüft die Datenbankverbindung - SQLite im WAL-Modus unter /data/app.db - Auslieferung des gebauten Frontends mit SPA-Fallback - leere Basis-Migration, Tests mit pytest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ff666175d0
commit
8e6ef05304
15 files changed
+414
No files matched your search
@@ -0,0 +1,23 @@
|
||||
from sqlalchemy import text
|
||||
|
||||
from app import __version__
|
||||
from app.db import get_engine
|
||||
|
||||
|
||||
def test_health_ok(client):
|
||||
response = client.get("/api/health")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"status": "ok", "version": __version__, "db": "ok"}
|
||||
|
||||
|
||||
def test_sqlite_uses_wal(client):
|
||||
client.get("/api/health")
|
||||
|
||||
with get_engine().connect() as conn:
|
||||
assert conn.execute(text("PRAGMA journal_mode")).scalar() == "wal"
|
||||
assert conn.execute(text("PRAGMA foreign_keys")).scalar() == 1
|
||||
|
||||
|
||||
def test_unknown_api_path_returns_404(client):
|
||||
assert client.get("/api/does-not-exist").status_code == 404
|
||||
Reference in new issue
Block a user