31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""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
|