From e10d4a96e062818cb2395add1746c733a053c374 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Wed, 1 Apr 2026 17:25:54 +0900 Subject: feat: add FastAPI REST API service --- services/api/tests/__init__.py | 0 services/api/tests/test_api.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 services/api/tests/__init__.py create mode 100644 services/api/tests/test_api.py (limited to 'services/api/tests') diff --git a/services/api/tests/__init__.py b/services/api/tests/__init__.py new file mode 100644 index 0000000..e69de29 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" -- cgit v1.2.3