from fastapi.testclient import TestClient from finrep_algo_agent.main import app client = TestClient(app) def test_health() -> None: r = client.get("/health") assert r.status_code == 200 data = r.json() assert data["status"] == "ok" def test_debug_runtime() -> None: r = client.get("/debug/runtime") assert r.status_code == 200 body = r.json() assert "stub_skills" in body assert "rag_defaults" in body def test_outline_l1_stub() -> None: r = client.post( "/v1/outline/l1", json={"report_type": "项目融资", "chapter_candidates": [{"chapter_id": "a", "chapter_name": "测试章"}]}, ) assert r.status_code == 200 body = r.json() assert "chapter_results" in body assert len(body["chapter_results"]) >= 1 def test_section_stub() -> None: r = client.post( "/v1/section", json={"knowledge_unit_id": "ku-1", "template_type": "info"}, ) assert r.status_code == 200 assert "generated_text" in r.json() def test_outline_l2_s2_returns_empty_structure_in_stub() -> None: r = client.post( "/v1/outline/l2", json={ "chapter_name": "企业基本情况分析", "chapter_no": "1", "chapter_presentation_enum": "S2", }, ) assert r.status_code == 200 body = r.json() assert body["chapter_structure"] == []