Skip to content

Commit 0347acf

Browse files
committed
fix: update orchestrator tests and durable agent metadata access
Signed-off-by: Roberto Rodriguez <[email protected]>
1 parent df287b9 commit 0347acf

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

tests/agents/durableagent/test_durable_agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def test_durable_agent_initialization_name_from_role(self, mock_llm):
257257

258258
def test_durable_agent_metadata(self, basic_durable_agent):
259259
"""Test durable agent metadata creation."""
260-
metadata = basic_durable_agent._agent_metadata
260+
metadata = basic_durable_agent.agent_metadata
261261

262262
assert metadata is not None
263263
assert metadata["name"] == "TestDurableAgent"
@@ -275,6 +275,7 @@ def mock_wf_client(self):
275275
}
276276
return client
277277

278+
@pytest.mark.skip(reason="DurableAgent doesn't have a run() method - uses workflow invocation")
278279
@pytest.mark.asyncio
279280
async def test_run_method(self, basic_durable_agent, mock_wf_client):
280281
"""Test the run method returns the workflow result from the injected mock client."""

tests/workflow/orchestrators/test_random.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,33 @@ def test_random_orchestrator_initialization(orchestrator_config):
2727

2828
@pytest.mark.asyncio
2929
async def test_process_input(orchestrator_config):
30-
"""Test the process_input task."""
30+
"""Test the _process_input_activity task."""
3131
with patch("dapr.ext.workflow.WorkflowRuntime") as mock_runtime:
3232
mock_runtime.return_value = MagicMock()
3333
orchestrator = RandomOrchestrator(**orchestrator_config)
34+
35+
# Mock the activity context
36+
mock_ctx = MagicMock()
3437
task = "test task"
35-
result = await orchestrator.process_input(task)
38+
result = orchestrator._process_input_activity(mock_ctx, {"task": task})
3639

3740
assert result["role"] == "user"
38-
assert result["name"] == "test_orchestrator"
41+
assert result["name"] == "user"
3942
assert result["content"] == task
4043

4144

4245
def test_select_random_speaker(orchestrator_config):
43-
"""Test the select_random_speaker task."""
46+
"""Test the _select_random_speaker_activity task."""
4447
with patch("dapr.ext.workflow.WorkflowRuntime") as mock_runtime, patch.object(
4548
RandomOrchestrator,
46-
"get_agents_metadata",
49+
"list_team_agents",
4750
return_value={"agent1": {"name": "agent1"}, "agent2": {"name": "agent2"}},
4851
):
4952
mock_runtime.return_value = MagicMock()
5053
orchestrator = RandomOrchestrator(**orchestrator_config)
5154

52-
speaker = orchestrator.select_random_speaker()
55+
# Mock the activity context
56+
mock_ctx = MagicMock()
57+
speaker = orchestrator._select_random_speaker_activity(mock_ctx)
58+
5359
assert speaker in ["agent1", "agent2"]
54-
assert orchestrator.current_speaker == speaker

0 commit comments

Comments
 (0)