@@ -115,7 +115,11 @@ def mock_httpx_client() -> AsyncMock:
115115
116116@pytest .fixture
117117def mock_agent_card () -> MagicMock :
118- return MagicMock (spec = AgentCard , url = 'http://agent.example.com/api' )
118+ mock = MagicMock (spec = AgentCard , url = 'http://agent.example.com/api' )
119+ # The attribute is accessed in the client's __init__ to determine if an
120+ # extended card needs to be fetched.
121+ mock .supports_authenticated_extended_card = False
122+ return mock
119123
120124
121125async def async_iterable_from_list (
@@ -397,7 +401,7 @@ async def test_get_client_from_agent_card_url_success(
397401 mock_resolver_instance .get_agent_card .return_value = mock_agent_card
398402
399403 with patch (
400- 'a2a.client.client .A2ACardResolver' ,
404+ 'a2a.client.jsonrpc_client .A2ACardResolver' ,
401405 return_value = mock_resolver_instance ,
402406 ) as mock_resolver_class :
403407 client = await A2AClient .get_client_from_agent_card_url (
@@ -426,7 +430,7 @@ async def test_get_client_from_agent_card_url_resolver_error(
426430 ):
427431 error_to_raise = A2AClientHTTPError (404 , 'Agent card not found' )
428432 with patch (
429- 'a2a.client.client .A2ACardResolver.get_agent_card' ,
433+ 'a2a.client.jsonrpc_client .A2ACardResolver.get_agent_card' ,
430434 new_callable = AsyncMock ,
431435 side_effect = error_to_raise ,
432436 ):
@@ -528,7 +532,7 @@ async def test_send_message_error_response(
528532 ) == InvalidParamsError ().model_dump (exclude_none = True )
529533
530534 @pytest .mark .asyncio
531- @patch ('a2a.client.client .aconnect_sse' )
535+ @patch ('a2a.client.jsonrpc_client .aconnect_sse' )
532536 async def test_send_message_streaming_success_request (
533537 self ,
534538 mock_aconnect_sse : AsyncMock ,
@@ -617,7 +621,7 @@ async def test_send_message_streaming_success_request(
617621 ) # Default timeout for streaming
618622
619623 @pytest .mark .asyncio
620- @patch ('a2a.client.client .aconnect_sse' )
624+ @patch ('a2a.client.jsonrpc_client .aconnect_sse' )
621625 async def test_send_message_streaming_http_kwargs_passed (
622626 self ,
623627 mock_aconnect_sse : AsyncMock ,
@@ -658,7 +662,7 @@ async def test_send_message_streaming_http_kwargs_passed(
658662 ) # Ensure custom timeout is used
659663
660664 @pytest .mark .asyncio
661- @patch ('a2a.client.client .aconnect_sse' )
665+ @patch ('a2a.client.jsonrpc_client .aconnect_sse' )
662666 async def test_send_message_streaming_sse_error_handling (
663667 self ,
664668 mock_aconnect_sse : AsyncMock ,
@@ -693,7 +697,7 @@ async def test_send_message_streaming_sse_error_handling(
693697 assert 'Simulated SSE protocol error' in str (exc_info .value )
694698
695699 @pytest .mark .asyncio
696- @patch ('a2a.client.client .aconnect_sse' )
700+ @patch ('a2a.client.jsonrpc_client .aconnect_sse' )
697701 async def test_send_message_streaming_json_decode_error_handling (
698702 self ,
699703 mock_aconnect_sse : AsyncMock ,
@@ -731,7 +735,7 @@ async def test_send_message_streaming_json_decode_error_handling(
731735 ) # Example of JSONDecodeError message
732736
733737 @pytest .mark .asyncio
734- @patch ('a2a.client.client .aconnect_sse' )
738+ @patch ('a2a.client.jsonrpc_client .aconnect_sse' )
735739 async def test_send_message_streaming_httpx_request_error_handling (
736740 self ,
737741 mock_aconnect_sse : AsyncMock ,
@@ -858,7 +862,7 @@ async def test_set_task_callback_success(
858862 client , '_send_request' , new_callable = AsyncMock
859863 ) as mock_send_req ,
860864 patch (
861- 'a2a.client.client .uuid4' ,
865+ 'a2a.client.jsonrpc_client .uuid4' ,
862866 return_value = MagicMock (hex = 'testuuid' ),
863867 ) as mock_uuid ,
864868 ):
@@ -1003,7 +1007,7 @@ async def test_get_task_callback_success(
10031007 client , '_send_request' , new_callable = AsyncMock
10041008 ) as mock_send_req ,
10051009 patch (
1006- 'a2a.client.client .uuid4' ,
1010+ 'a2a.client.jsonrpc_client .uuid4' ,
10071011 return_value = MagicMock (hex = 'testgetuuid' ),
10081012 ) as mock_uuid ,
10091013 ):
0 commit comments