31 lines
871 B
Python
31 lines
871 B
Python
|
|
"""Tests for the health check endpoint."""
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
from httpx import AsyncClient
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.asyncio
|
||
|
|
async def test_health_check(client: AsyncClient):
|
||
|
|
"""GET /api/v1/health returns 200 with status ok."""
|
||
|
|
response = await client.get("/api/v1/health")
|
||
|
|
assert response.status_code == 200
|
||
|
|
data = response.json()
|
||
|
|
assert data["status"] == "ok"
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.asyncio
|
||
|
|
async def test_health_no_auth_required(client: AsyncClient):
|
||
|
|
"""Health endpoint works without authentication."""
|
||
|
|
response = await client.get("/api/v1/health")
|
||
|
|
assert response.status_code == 200
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.asyncio
|
||
|
|
async def test_root_endpoint(client: AsyncClient):
|
||
|
|
"""Root endpoint returns app info."""
|
||
|
|
response = await client.get("/")
|
||
|
|
assert response.status_code == 200
|
||
|
|
data = response.json()
|
||
|
|
assert "name" in data
|
||
|
|
assert "version" in data
|