Skip to content

Commit 726b648

Browse files
committed
add get extended agent card test for the default request handler
1 parent e2361ad commit 726b648

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

tests/server/request_handlers/test_default_request_handler.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2853,6 +2853,37 @@ async def test_on_message_send_negative_history_length_error(agent_card):
28532853
assert 'history length must be non-negative' in exc_info.value.message
28542854

28552855

2856+
@pytest.mark.asyncio
2857+
async def test_on_get_extended_agent_card_success(agent_card):
2858+
"""Test on_get_extended_agent_card when extended_agent_card is supported."""
2859+
agent_card.capabilities.extended_agent_card = True
2860+
2861+
extended_agent_card = AgentCard(
2862+
name='Extended Agent',
2863+
description='An extended agent',
2864+
version='1.0.0',
2865+
capabilities=AgentCapabilities(
2866+
streaming=True,
2867+
push_notifications=True,
2868+
extended_agent_card=True,
2869+
),
2870+
)
2871+
2872+
request_handler = DefaultRequestHandler(
2873+
agent_executor=AsyncMock(spec=AgentExecutor),
2874+
task_store=AsyncMock(spec=TaskStore),
2875+
agent_card=agent_card,
2876+
extended_agent_card=extended_agent_card,
2877+
)
2878+
2879+
params = GetExtendedAgentCardRequest()
2880+
context = create_server_call_context()
2881+
2882+
result = await request_handler.on_get_extended_agent_card(params, context)
2883+
2884+
assert result == extended_agent_card
2885+
2886+
28562887
@pytest.mark.asyncio
28572888
async def test_on_message_send_stream_unsupported(agent_card):
28582889
"""Test on_message_send_stream when streaming is unsupported."""

0 commit comments

Comments
 (0)