test_health.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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_debug_runtime() -> None:
  10. r = client.get("/debug/runtime")
  11. assert r.status_code == 200
  12. body = r.json()
  13. assert "stub_skills" in body
  14. assert "rag_defaults" in body
  15. def test_outline_l1_stub() -> None:
  16. r = client.post(
  17. "/v1/outline/l1",
  18. json={"report_type": "项目融资", "chapter_candidates": [{"chapter_id": "a", "chapter_name": "测试章"}]},
  19. )
  20. assert r.status_code == 200
  21. body = r.json()
  22. assert "chapter_results" in body
  23. assert len(body["chapter_results"]) >= 1
  24. def test_section_stub() -> None:
  25. r = client.post(
  26. "/v1/section",
  27. json={"knowledge_unit_id": "ku-1", "template_type": "info"},
  28. )
  29. assert r.status_code == 200
  30. assert "generated_text" in r.json()
  31. def test_outline_l2_s2_returns_empty_structure_in_stub() -> None:
  32. r = client.post(
  33. "/v1/outline/l2",
  34. json={
  35. "chapter_name": "企业基本情况分析",
  36. "chapter_no": "1",
  37. "chapter_presentation_enum": "S2",
  38. },
  39. )
  40. assert r.status_code == 200
  41. body = r.json()
  42. assert body["chapter_structure"] == []