"""Tests for health check endpoint.""" import pytest from fastapi.testclient import TestClient from app.main import app client = TestClient(app) class TestHealthCheck: """Test cases for health check endpoint.""" def test_health_endpoint_exists(self): """Test that health endpoint is accessible.""" response = client.get("/api/v1/health") assert response.status_code in [200, 503] # 200 if DB connected, 503 if not def test_health_response_structure(self): """Test that health response has expected structure.""" response = client.get("/api/v1/health") data = response.json() assert "status" in data assert "database" in data assert "version" in data def test_readiness_probe(self): """Test readiness probe endpoint.""" response = client.get("/api/v1/health/ready") assert response.status_code == 200 assert response.json() == {"ready": True} def test_liveness_probe(self): """Test liveness probe endpoint.""" response = client.get("/api/v1/health/live") assert response.status_code == 200 assert response.json() == {"alive": True}