test_smoke.py 729 B

1234567891011121314151617181920212223242526272829303132
  1. import pytest
  2. from src.trader_mcp.server import app
  3. # Ensure src is a valid package import target in all runners.
  4. @pytest.fixture
  5. def client():
  6. try:
  7. from fastapi.testclient import TestClient
  8. except Exception as e: # pragma: no cover
  9. pytest.skip(f"TestClient not available: {e}")
  10. return TestClient(app)
  11. def test_root(client):
  12. r = client.get("/")
  13. assert r.status_code == 200
  14. assert r.json().get("status") == "ok"
  15. def test_health(client):
  16. r = client.get("/health")
  17. assert r.status_code == 200
  18. assert r.json().get("status") == "ok"
  19. def test_dashboard(client):
  20. r = client.get("/dashboard/")
  21. assert r.status_code == 200
  22. assert "Trader MCP Dashboard" in r.text