Skip to content

Commit cbcad96

Browse files
Testcases
1 parent e48cc18 commit cbcad96

File tree

2 files changed

+2
-86
lines changed

2 files changed

+2
-86
lines changed

src/backend/tests/agents/test_group_chat_manager.py

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
Plan,
2929
ActionRequest,
3030
)
31-
from autogen_core.base import AgentInstantiationContext, AgentRuntime
31+
from autogen_core.base import MessageContext, AgentInstantiationContext, AgentRuntime
3232
from autogen_core.components.models import AzureOpenAIChatCompletionClient
3333
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
3434
from autogen_core.base import AgentId
@@ -102,91 +102,6 @@ async def test_update_step_status(mock_track_event, setup_group_chat_manager):
102102
)
103103

104104

105-
@pytest.mark.asyncio
106-
@patch("src.backend.agents.group_chat_manager.track_event_if_configured")
107-
async def test_execute_step(mock_track_event, setup_group_chat_manager):
108-
"""
109-
Test the `_execute_step` method.
110-
"""
111-
group_chat_manager, mock_memory, session_id, user_id, mock_agent_ids = setup_group_chat_manager
112-
113-
# Create a mock Step
114-
step = Step(
115-
id="test_step_id",
116-
session_id=session_id,
117-
plan_id="test_plan_id",
118-
user_id=user_id,
119-
action="Test Action",
120-
agent=BAgentType.planner_agent,
121-
status=StepStatus.planned,
122-
)
123-
124-
# Mock memory responses
125-
mock_plan = Plan(
126-
id="test_plan_id",
127-
session_id=session_id,
128-
user_id=user_id,
129-
summary="Test Plan Summary",
130-
initial_goal="Test Initial Goal",
131-
)
132-
mock_memory.get_plan_by_session.return_value = mock_plan
133-
mock_memory.get_steps_by_plan.return_value = [step]
134-
135-
# Mock helper methods
136-
group_chat_manager.send_message = AsyncMock()
137-
138-
# Call the method
139-
await group_chat_manager._execute_step(session_id, step)
140-
141-
# Assertions
142-
step.status = StepStatus.action_requested
143-
mock_memory.update_step.assert_called_once_with(step)
144-
145-
mock_track_event.assert_has_calls([
146-
call(
147-
"Group Chat Manager - Update step to action_requested and updated into the cosmos",
148-
{
149-
"status": step.status,
150-
"session_id": step.session_id,
151-
"user_id": user_id,
152-
"source": step.agent,
153-
},
154-
),
155-
call(
156-
"Group Chat Manager - Requesting Planneragent to perform the action and added into the cosmos",
157-
{
158-
"session_id": session_id,
159-
"user_id": user_id,
160-
"plan_id": "test_plan_id",
161-
"content": f"Requesting Planneragent to perform action: {step.action}",
162-
"source": "GroupChatManager",
163-
"step_id": step.id,
164-
},
165-
),
166-
])
167-
168-
# Adjusted expected ActionRequest
169-
expected_action_request = ActionRequest(
170-
step_id="test_step_id",
171-
plan_id="test_plan_id",
172-
session_id="test_session_id",
173-
action=(
174-
"<conversation_history>Here is the conversation history so far for the current plan. "
175-
"This information may or may not be relevant to the step you have been asked to execute."
176-
"The user's task was:\nTest Plan Summary\n\n"
177-
"The conversation between the previous agents so far is below:\n<conversation_history \\>. "
178-
"Here is the step to action: Test Action. ONLY perform the steps and actions required to complete this specific step, "
179-
"the other steps have already been completed. Only use the conversational history for additional information, "
180-
"if it's required to complete the step you have been assigned."
181-
),
182-
agent=BAgentType.planner_agent,
183-
)
184-
185-
group_chat_manager.send_message.assert_called_once_with(
186-
expected_action_request, mock_agent_ids[BAgentType.planner_agent]
187-
)
188-
189-
190105
@pytest.mark.asyncio
191106
async def test_update_step_invalid_feedback_status(setup_group_chat_manager):
192107
"""

src/backend/tests/agents/test_hr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
)
5252
# pylint: enable=C0413
5353

54+
5455
@pytest.mark.asyncio
5556
async def test_schedule_orientation_session():
5657
"""Test scheduling an orientation session."""

0 commit comments

Comments
 (0)