| 1234567891011121314151617181920212223242526272829303132 |
- import pytest
- from src.trader_mcp.server import app
- # Ensure src is a valid package import target in all runners.
- @pytest.fixture
- def client():
- try:
- from fastapi.testclient import TestClient
- except Exception as e: # pragma: no cover
- pytest.skip(f"TestClient not available: {e}")
- return TestClient(app)
- def test_root(client):
- r = client.get("/")
- assert r.status_code == 200
- assert r.json().get("status") == "ok"
- def test_health(client):
- r = client.get("/health")
- assert r.status_code == 200
- assert r.json().get("status") == "ok"
- def test_dashboard(client):
- r = client.get("/dashboard/")
- assert r.status_code == 200
- assert "Trader MCP Dashboard" in r.text
|