| import pytest |
|
|
| from src.orchestrators import Orchestrator |
| from src.utils.models import OrchestratorConfig |
|
|
|
|
| @pytest.mark.asyncio |
| @pytest.mark.e2e |
| async def test_simple_mode_completes(mock_search_handler, mock_judge_handler): |
| """Verify Simple mode runs without crashing using mocks.""" |
|
|
| config = OrchestratorConfig(max_iterations=2) |
|
|
| orchestrator = Orchestrator( |
| search_handler=mock_search_handler, |
| judge_handler=mock_judge_handler, |
| config=config, |
| enable_analysis=False, |
| enable_embeddings=False, |
| ) |
|
|
| events = [] |
| async for event in orchestrator.run("test query"): |
| events.append(event) |
|
|
| |
| assert any(e.type == "complete" for e in events), "Did not receive complete event" |
| |
| assert not any(e.type == "error" for e in events), "Received error event" |
|
|
| |
| complete_event = next(e for e in events if e.type == "complete") |
| |
| assert "MockDrug A" in complete_event.message |
| assert "Finding 1" in complete_event.message |
|
|
|
|
| @pytest.mark.asyncio |
| @pytest.mark.e2e |
| async def test_simple_mode_structure_validation(mock_search_handler, mock_judge_handler): |
| """Verify output contains expected structure (citations, headings).""" |
| config = OrchestratorConfig(max_iterations=2) |
| orchestrator = Orchestrator( |
| search_handler=mock_search_handler, |
| judge_handler=mock_judge_handler, |
| config=config, |
| enable_analysis=False, |
| enable_embeddings=False, |
| ) |
|
|
| events = [] |
| async for event in orchestrator.run("test query"): |
| events.append(event) |
|
|
| complete_event = next(e for e in events if e.type == "complete") |
| report = complete_event.message |
|
|
| |
| assert "## Sexual Health Analysis" in report |
| assert "### Citations" in report |
| assert "### Key Findings" in report |
|
|
| |
| assert "Study on test query" in report |
| assert "https://pubmed.example.com/123" in report |
|
|