test: enhance message routing verification with context history
This commit is contained in:
@@ -87,31 +87,53 @@ def step_impl(context):
|
||||
|
||||
@then("each message should be routed to the appropriate agent")
|
||||
def step_impl(context):
|
||||
# Check that each message was routed to the right agent
|
||||
# Verify that each message was routed to the correct agent
|
||||
assert context.responses["help"] == "Response from agent1"
|
||||
assert context.responses["search"] == "Response from agent2"
|
||||
assert context.responses["long"] == "Response from agent3"
|
||||
|
||||
# Check that each agent's process method was called with the right message and context
|
||||
# Agent1's context history will contain its own interaction
|
||||
context.agents["agent1"].process.assert_called_once_with(
|
||||
"I need help with something",
|
||||
{
|
||||
"message": "I need help with something",
|
||||
"initial_message": "I need help with something",
|
||||
"history": [
|
||||
{
|
||||
"source": "input",
|
||||
"destination": "agent1",
|
||||
"message": "Response from agent1",
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
# Agent2's context history will contain its own interaction
|
||||
context.agents["agent2"].process.assert_called_once_with(
|
||||
"Can you search for information?",
|
||||
{
|
||||
"message": "Can you search for information?",
|
||||
"initial_message": "Can you search for information?",
|
||||
"history": [
|
||||
{
|
||||
"source": "input",
|
||||
"destination": "agent2",
|
||||
"message": "Response from agent2",
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
# Agent3's context history will contain its own interaction
|
||||
context.agents["agent3"].process.assert_called_once_with(
|
||||
"This is a longer message with more than five words",
|
||||
{
|
||||
"message": "This is a longer message with more than five words",
|
||||
"initial_message": "This is a longer message with more than five words",
|
||||
"history": [
|
||||
{
|
||||
"source": "input",
|
||||
"destination": "agent3",
|
||||
"message": "Response from agent3",
|
||||
},
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user