1919from starlette .testclient import TestClient
2020
2121from a2a .server .apps import (
22- A2AStarletteApplication ,
2322 A2AFastAPIApplication ,
23+ A2AStarletteApplication ,
2424)
2525from a2a .types import (
2626 AgentCapabilities ,
@@ -135,6 +135,7 @@ def handler():
135135def app (agent_card : AgentCard , handler : mock .AsyncMock ):
136136 return A2AStarletteApplication (agent_card , handler )
137137
138+
138139@pytest .fixture
139140def client (app : A2AStarletteApplication , ** kwargs ):
140141 """Create a test client with the Starlette app."""
@@ -167,6 +168,7 @@ def test_authenticated_extended_agent_card_endpoint_not_supported(
167168 response = client .get ('/agent/authenticatedExtendedCard' )
168169 assert response .status_code == 404 # Starlette's default for no route
169170
171+
170172def test_authenticated_extended_agent_card_endpoint_not_supported_fastapi (
171173 agent_card : AgentCard , handler : mock .AsyncMock
172174):
@@ -207,6 +209,7 @@ def test_authenticated_extended_agent_card_endpoint_supported_with_specific_exte
207209 'Extended skill not found in served card'
208210 )
209211
212+
210213def test_authenticated_extended_agent_card_endpoint_supported_with_specific_extended_card_fastapi (
211214 agent_card : AgentCard ,
212215 extended_agent_card_fixture : AgentCard ,
@@ -232,6 +235,7 @@ def test_authenticated_extended_agent_card_endpoint_supported_with_specific_exte
232235 'Extended skill not found in served card'
233236 )
234237
238+
235239def test_agent_card_custom_url (
236240 app : A2AStarletteApplication , agent_card : AgentCard
237241):
@@ -267,6 +271,7 @@ def test_starlette_rpc_endpoint_custom_url(
267271 data = response .json ()
268272 assert data ['result' ]['id' ] == 'task1'
269273
274+
270275def test_fastapi_rpc_endpoint_custom_url (
271276 app : A2AFastAPIApplication , handler : mock .AsyncMock
272277):
@@ -291,6 +296,7 @@ def test_fastapi_rpc_endpoint_custom_url(
291296 data = response .json ()
292297 assert data ['result' ]['id' ] == 'task1'
293298
299+
294300def test_starlette_build_with_extra_routes (
295301 app : A2AStarletteApplication , agent_card : AgentCard
296302):
@@ -314,6 +320,7 @@ def custom_handler(request):
314320 data = response .json ()
315321 assert data ['name' ] == agent_card .name
316322
323+
317324def test_fastapi_build_with_extra_routes (
318325 app : A2AFastAPIApplication , agent_card : AgentCard
319326):
0 commit comments