diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 17:25:54 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 17:25:54 +0900 |
| commit | e10d4a96e062818cb2395add1746c733a053c374 (patch) | |
| tree | bbd222cd840d2c7fc58d3109362fb1b0c00aee26 /services/api/tests/test_api.py | |
| parent | 21c6b777530b4a027aec9c12bf63092e5a7c006d (diff) | |
feat: add FastAPI REST API service
Diffstat (limited to 'services/api/tests/test_api.py')
| -rw-r--r-- | services/api/tests/test_api.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/services/api/tests/test_api.py b/services/api/tests/test_api.py new file mode 100644 index 0000000..99cf9e3 --- /dev/null +++ b/services/api/tests/test_api.py @@ -0,0 +1,17 @@ +"""Tests for the REST API.""" +import pytest +from unittest.mock import AsyncMock, MagicMock, 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" |
