From bcd6f4e2b9b3dca013dff54f2b9db6c20748a2d2 Mon Sep 17 00:00:00 2001 From: Neelay Shah Date: Mon, 9 Feb 2026 16:50:23 +0100 Subject: [PATCH] task: Link tests for MCP SISs --- tests/aignostics/cli_test.py | 9 ++++++--- tests/aignostics/utils/mcp_test.py | 24 ++++++++++++++++-------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/tests/aignostics/cli_test.py b/tests/aignostics/cli_test.py index 34dc19056..f7674902f 100644 --- a/tests/aignostics/cli_test.py +++ b/tests/aignostics/cli_test.py @@ -297,16 +297,18 @@ def mock_uvicorn_run(app, host=None, port=None): @pytest.mark.unit -def test_cli_mcp_run_command(runner: CliRunner) -> None: +def test_cli_mcp_run_command(runner: CliRunner, record_property) -> None: """Test run command starts the MCP server.""" + record_property("tested-item-id", "SPEC-UTILS-SERVICE") with patch(PATCH_RUN) as mock_run: runner.invoke(cli, ["mcp", "run"]) mock_run.assert_called_once() @pytest.mark.unit -def test_cli_mcp_list_tools(runner: CliRunner) -> None: +def test_cli_mcp_list_tools(runner: CliRunner, record_property) -> None: """Test list-tools command displays discovered tools.""" + record_property("tested-item-id", "SPEC-UTILS-SERVICE") test_server = FastMCP("test") @test_server.tool @@ -322,8 +324,9 @@ def test_tool() -> str: @pytest.mark.unit -def test_cli_mcp_list_tools_empty(runner: CliRunner) -> None: +def test_cli_mcp_list_tools_empty(runner: CliRunner, record_property) -> None: """Test list-tools command with no tools.""" + record_property("tested-item-id", "SPEC-UTILS-SERVICE") with patch(PATCH_MCP_LOCATE_IMPLEMENTATIONS, return_value=[]): result = runner.invoke(cli, ["mcp", "list-tools"]) assert result.exit_code == 0 diff --git a/tests/aignostics/utils/mcp_test.py b/tests/aignostics/utils/mcp_test.py index 28ae4771e..365ea5fa3 100644 --- a/tests/aignostics/utils/mcp_test.py +++ b/tests/aignostics/utils/mcp_test.py @@ -25,8 +25,9 @@ @pytest.mark.unit -def test_mcp_discover_servers_returns_list() -> None: +def test_mcp_discover_servers_returns_list(record_property) -> None: """Test that mcp_discover_servers returns a list of servers.""" + record_property("tested-item-id", "SPEC-UTILS-SERVICE") test_server = FastMCP("test_server") with patch(PATCH_LOCATE_IMPLEMENTATIONS, return_value=[test_server]) as mock_locate: servers = mcp_discover_servers() @@ -36,16 +37,18 @@ def test_mcp_discover_servers_returns_list() -> None: @pytest.mark.unit -def test_mcp_discover_servers_empty() -> None: +def test_mcp_discover_servers_empty(record_property) -> None: """Test that mcp_discover_servers handles no servers found.""" + record_property("tested-item-id", "SPEC-UTILS-SERVICE") with patch(PATCH_LOCATE_IMPLEMENTATIONS, return_value=[]): servers = mcp_discover_servers() assert servers == [] @pytest.mark.integration -def test_mcp_discover_servers_real_discovery() -> None: +def test_mcp_discover_servers_real_discovery(record_property) -> None: """Test discovery without mocking.""" + record_property("tested-item-id", "SPEC-UTILS-SERVICE") servers = mcp_discover_servers() assert isinstance(servers, list) for server in servers: @@ -58,8 +61,9 @@ def test_mcp_discover_servers_real_discovery() -> None: @pytest.mark.unit -def test_mcp_create_server() -> None: +def test_mcp_create_server(record_property) -> None: """Test server creation.""" + record_property("tested-item-id", "SPEC-UTILS-SERVICE") with patch(PATCH_LOCATE_IMPLEMENTATIONS, return_value=[]): server = mcp_create_server() assert isinstance(server, FastMCP) @@ -67,8 +71,9 @@ def test_mcp_create_server() -> None: @pytest.mark.unit -def test_mcp_create_server_mounts_discovered() -> None: +def test_mcp_create_server_mounts_discovered(record_property) -> None: """Test that mcp_create_server mounts discovered servers with their tools.""" + record_property("tested-item-id", "SPEC-UTILS-SERVICE") plugin1 = FastMCP("plugin1") plugin2 = FastMCP("plugin2") @@ -100,8 +105,9 @@ def plugin2_tool() -> str: @pytest.mark.unit -def test_mcp_create_server_skips_duplicate_names(caplog: pytest.LogCaptureFixture) -> None: +def test_mcp_create_server_skips_duplicate_names(caplog: pytest.LogCaptureFixture, record_property) -> None: """Test that servers with duplicate names are skipped with warning.""" + record_property("tested-item-id", "SPEC-UTILS-SERVICE") dup1 = FastMCP("duplicate_name") dup2 = FastMCP("duplicate_name") unique = FastMCP("unique_name") @@ -144,8 +150,9 @@ def unique_tool() -> str: @pytest.mark.unit -def test_mcp_list_tools_returns_tool_info() -> None: +def test_mcp_list_tools_returns_tool_info(record_property) -> None: """Test that mcp_list_tools returns correct tool information.""" + record_property("tested-item-id", "SPEC-UTILS-SERVICE") test_server = FastMCP("test") @test_server.tool @@ -161,8 +168,9 @@ def test_tool(param: str) -> str: @pytest.mark.unit -def test_mcp_list_tools_empty() -> None: +def test_mcp_list_tools_empty(record_property) -> None: """Test mcp_list_tools with no discovered tools.""" + record_property("tested-item-id", "SPEC-UTILS-SERVICE") with patch(PATCH_LOCATE_IMPLEMENTATIONS, return_value=[]): tools = mcp_list_tools() # Should return empty list when no plugins have tools