summaryrefslogtreecommitdiff
path: root/services/api/tests
diff options
context:
space:
mode:
Diffstat (limited to 'services/api/tests')
-rw-r--r--services/api/tests/__init__.py0
-rw-r--r--services/api/tests/test_api.py17
2 files changed, 17 insertions, 0 deletions
diff --git a/services/api/tests/__init__.py b/services/api/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/services/api/tests/__init__.py
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"