feat: add FastAPI app factory and health check endpoint
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
30
tests/test_health.py
Normal file
30
tests/test_health.py
Normal 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
|
||||
Reference in New Issue
Block a user