"""Tests for the REST API.""" from unittest.mock import AsyncMock, patch from fastapi.testclient import TestClient def test_health_endpoint(): """Health endpoint returns ok.""" from trading_api.main import app # Override lifespan to skip DB with patch("trading_api.main.lifespan") as mock_lifespan: mock_lifespan.return_value.__aenter__ = AsyncMock() mock_lifespan.return_value.__aexit__ = AsyncMock() client = TestClient(app) response = client.get("/health") assert response.status_code == 200 assert response.json()["status"] == "ok"