feat: add FastAPI app factory and health check endpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 09:12:31 -06:00
parent fb4b948681
commit b3b34222c8
6 changed files with 156 additions and 2 deletions

30
tests/test_health.py Normal file
View File

@@ -0,0 +1,30 @@
"""Tests for the health check endpoint."""
from fastapi.testclient import TestClient
class TestHealthCheck:
"""Tests for GET /health."""
def test_health_returns_200(self, client: TestClient) -> None:
"""GET /health should return HTTP 200."""
response = client.get("/health")
assert response.status_code == 200
def test_health_returns_status_ok(self, client: TestClient) -> None:
"""GET /health should return a JSON body with status 'ok'."""
response = client.get("/health")
data = response.json()
assert data["status"] == "ok"
def test_health_includes_app_name(self, client: TestClient) -> None:
"""GET /health should include the application name."""
response = client.get("/health")
data = response.json()
assert data["app"] == "sneakyswole"
def test_health_includes_version(self, client: TestClient) -> None:
"""GET /health should include the application version."""
response = client.get("/health")
data = response.json()
assert "version" in data