Skip to content

Commit a809fd1

Browse files
committed
fix(tests): update agentgateway unit tests after upstream merge
- Add ord_id=None to get_mcp_tools_customer assertions - Update IAS fragment error message regexes to match new specific messages - Redirect call_mcp_tool_lob mock patches from _mcp_session to _lob
1 parent 6ef3f18 commit a809fd1

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

tests/agentgateway/unit/test_agw_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ async def test_customer_flow_passes_system_token(self):
521521
await agw_client.list_mcp_tools(app_tid="tid")
522522

523523
mock_customer.assert_called_once_with(
524-
mock_creds, "customer-system-token", 60.0
524+
mock_creds, "customer-system-token", 60.0, ord_id=None
525525
)
526526

527527
@pytest.mark.asyncio
@@ -575,7 +575,7 @@ async def test_customer_flow_with_user_token_uses_user_auth(self):
575575
await agw_client.list_mcp_tools(user_token="user-jwt", app_tid="tid")
576576

577577
mock_customer.assert_called_once_with(
578-
mock_creds, "exchanged-user-token", 60.0
578+
mock_creds, "exchanged-user-token", 60.0, ord_id=None
579579
)
580580

581581

tests/agentgateway/unit/test_lob.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def test_raises_when_no_fragment_found(self):
270270
) as mock_client:
271271
mock_client.return_value.list_instance_fragments.return_value = []
272272

273-
with pytest.raises(MCPServerNotFoundError, match="No fragment found"):
273+
with pytest.raises(MCPServerNotFoundError, match="No IAS fragment found"):
274274
get_ias_fragment_name("tenant-sub")
275275

276276

@@ -316,7 +316,7 @@ def test_raises_when_no_fragment_found(self):
316316
with patch("sap_cloud_sdk.agentgateway._fragments.create_fragment_client") as mock_client:
317317
mock_client.return_value.list_instance_fragments.return_value = []
318318

319-
with pytest.raises(MCPServerNotFoundError, match="No fragment found"):
319+
with pytest.raises(MCPServerNotFoundError, match="No IAS user fragment found"):
320320
get_ias_user_fragment_name("tenant-sub")
321321

322322

@@ -623,11 +623,11 @@ async def test_calls_tool_with_pre_fetched_token(self):
623623
mock_result.content[0].text = "Tool result"
624624

625625
with (
626-
patch("sap_cloud_sdk.agentgateway._mcp_session.httpx.AsyncClient") as mock_http,
626+
patch("sap_cloud_sdk.agentgateway._lob.httpx.AsyncClient") as mock_http,
627627
patch(
628-
"sap_cloud_sdk.agentgateway._mcp_session.streamable_http_client"
628+
"sap_cloud_sdk.agentgateway._lob.streamable_http_client"
629629
) as mock_stream,
630-
patch("sap_cloud_sdk.agentgateway._mcp_session.ClientSession") as mock_session,
630+
patch("sap_cloud_sdk.agentgateway._lob.ClientSession") as mock_session,
631631
):
632632
# Setup async context managers
633633
mock_http_instance = AsyncMock()
@@ -675,11 +675,11 @@ async def test_returns_empty_string_when_no_content(self):
675675
mock_result.content = []
676676

677677
with (
678-
patch("sap_cloud_sdk.agentgateway._mcp_session.httpx.AsyncClient") as mock_http,
678+
patch("sap_cloud_sdk.agentgateway._lob.httpx.AsyncClient") as mock_http,
679679
patch(
680-
"sap_cloud_sdk.agentgateway._mcp_session.streamable_http_client"
680+
"sap_cloud_sdk.agentgateway._lob.streamable_http_client"
681681
) as mock_stream,
682-
patch("sap_cloud_sdk.agentgateway._mcp_session.ClientSession") as mock_session,
682+
patch("sap_cloud_sdk.agentgateway._lob.ClientSession") as mock_session,
683683
):
684684
mock_http_instance = AsyncMock()
685685
mock_http.return_value.__aenter__.return_value = mock_http_instance

0 commit comments

Comments
 (0)