Skip to content

Commit 89d5846

Browse files
committed
test(network): cover partial failure for ip route table
1 parent 8fcba10 commit 89d5846

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/tools/test_network.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,20 @@ async def test_get_ip_route_table_all(self, mcp_client, mock_execute):
255255
assert "ip route table (ipv6)" in result_text
256256
assert mock_execute.call_count == 2
257257

258+
async def test_get_ip_route_table_all_partial_failure(self, mcp_client, mock_execute):
259+
"""Test getting both IPv4 and IPv6 route tables with a failure."""
260+
mock_execute.side_effect = [
261+
(0, "default via 192.168.1.1 dev eth0", ""),
262+
(1, "", "Command not found"),
263+
]
264+
265+
result = await mcp_client.call_tool("get_ip_route_table", arguments={"family": "all"})
266+
result_text = result.content[0].text.casefold()
267+
268+
assert "ip route table (ipv4)" in result_text
269+
assert "error getting ipv6 routes" in result_text
270+
assert mock_execute.call_count == 2
271+
258272
@pytest.mark.parametrize(
259273
("return_value",),
260274
[

0 commit comments

Comments
 (0)