feat: Projektfundament mit Datenmodell, Migrationen und Seed
- Repo-Struktur für Backend, Frontend, Dokumentation und Gitea-Workflows - FastAPI-Skeleton mit pydantic-settings und RFC-7807-artigem Fehlerformat - Vollständiges Datenmodell (15 Tabellen) als SQLAlchemy-2.0-Modelle - Alembic gegen die Async-Engine inklusive Erstmigration - Idempotenter Seed für den deutschen Kategoriebaum und Standardregeln - Endpunkte /api/health und /api/version - pytest-Infrastruktur mit transaktionsisolierten Fixtures Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014e7t8UpmoVNMtWivY5LiSH
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""Tests der Systemendpunkte und des Fehlerformats."""
|
||||
|
||||
from httpx import AsyncClient
|
||||
|
||||
|
||||
async def test_health_meldet_datenbank_ok(client: AsyncClient) -> None:
|
||||
response = await client.get("/api/health")
|
||||
assert response.status_code == 200
|
||||
body = response.json()
|
||||
assert body["status"] == "ok"
|
||||
assert body["database"] == "ok"
|
||||
# Zeitstempel muss in Europe/Berlin geliefert werden (+01:00 oder +02:00).
|
||||
assert body["time"].endswith(("+01:00", "+02:00"))
|
||||
|
||||
|
||||
async def test_version_liefert_stammdaten(client: AsyncClient) -> None:
|
||||
body = (await client.get("/api/version")).json()
|
||||
assert body["name"] == "moneyfy"
|
||||
assert body["timezone"] == "Europe/Berlin"
|
||||
assert body["currency"] == "EUR"
|
||||
|
||||
|
||||
async def test_unbekannte_route_liefert_fehlerformat(client: AsyncClient) -> None:
|
||||
response = await client.get("/api/gibt-es-nicht")
|
||||
assert response.status_code == 404
|
||||
assert response.json() == {"detail": "Not Found", "code": "not_found"}
|
||||
Reference in New Issue
Block a user