test_health.py 824 B

1234567891011121314151617181920212223242526272829303132
  1. from fastapi.testclient import TestClient
  2. from finrep_algo_agent.main import app
  3. client = TestClient(app)
  4. def test_health() -> None:
  5. r = client.get("/health")
  6. assert r.status_code == 200
  7. data = r.json()
  8. assert data["status"] == "ok"
  9. def test_outline_l1_stub() -> None:
  10. r = client.post(
  11. "/v1/outline/l1",
  12. json={"report_type": "项目融资", "chapter_candidates": [{"chapter_id": "a", "chapter_name": "测试章"}]},
  13. )
  14. assert r.status_code == 200
  15. body = r.json()
  16. assert "chapter_results" in body
  17. assert len(body["chapter_results"]) >= 1
  18. def test_section_stub() -> None:
  19. r = client.post(
  20. "/v1/section",
  21. json={"knowledge_unit_id": "ku-1", "template_type": "info"},
  22. )
  23. assert r.status_code == 200
  24. assert "generated_text" in r.json()