Skip to content

Commit 266149c

Browse files
authored
task: Link tests for MCP SISs (#423)
1 parent 90f4c00 commit 266149c

2 files changed

Lines changed: 22 additions & 11 deletions

File tree

tests/aignostics/cli_test.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,16 +297,18 @@ def mock_uvicorn_run(app, host=None, port=None):
297297

298298

299299
@pytest.mark.unit
300-
def test_cli_mcp_run_command(runner: CliRunner) -> None:
300+
def test_cli_mcp_run_command(runner: CliRunner, record_property) -> None:
301301
"""Test run command starts the MCP server."""
302+
record_property("tested-item-id", "SPEC-UTILS-SERVICE")
302303
with patch(PATCH_RUN) as mock_run:
303304
runner.invoke(cli, ["mcp", "run"])
304305
mock_run.assert_called_once()
305306

306307

307308
@pytest.mark.unit
308-
def test_cli_mcp_list_tools(runner: CliRunner) -> None:
309+
def test_cli_mcp_list_tools(runner: CliRunner, record_property) -> None:
309310
"""Test list-tools command displays discovered tools."""
311+
record_property("tested-item-id", "SPEC-UTILS-SERVICE")
310312
test_server = FastMCP("test")
311313

312314
@test_server.tool
@@ -322,8 +324,9 @@ def test_tool() -> str:
322324

323325

324326
@pytest.mark.unit
325-
def test_cli_mcp_list_tools_empty(runner: CliRunner) -> None:
327+
def test_cli_mcp_list_tools_empty(runner: CliRunner, record_property) -> None:
326328
"""Test list-tools command with no tools."""
329+
record_property("tested-item-id", "SPEC-UTILS-SERVICE")
327330
with patch(PATCH_MCP_LOCATE_IMPLEMENTATIONS, return_value=[]):
328331
result = runner.invoke(cli, ["mcp", "list-tools"])
329332
assert result.exit_code == 0

tests/aignostics/utils/mcp_test.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525

2626

2727
@pytest.mark.unit
28-
def test_mcp_discover_servers_returns_list() -> None:
28+
def test_mcp_discover_servers_returns_list(record_property) -> None:
2929
"""Test that mcp_discover_servers returns a list of servers."""
30+
record_property("tested-item-id", "SPEC-UTILS-SERVICE")
3031
test_server = FastMCP("test_server")
3132
with patch(PATCH_LOCATE_IMPLEMENTATIONS, return_value=[test_server]) as mock_locate:
3233
servers = mcp_discover_servers()
@@ -36,16 +37,18 @@ def test_mcp_discover_servers_returns_list() -> None:
3637

3738

3839
@pytest.mark.unit
39-
def test_mcp_discover_servers_empty() -> None:
40+
def test_mcp_discover_servers_empty(record_property) -> None:
4041
"""Test that mcp_discover_servers handles no servers found."""
42+
record_property("tested-item-id", "SPEC-UTILS-SERVICE")
4143
with patch(PATCH_LOCATE_IMPLEMENTATIONS, return_value=[]):
4244
servers = mcp_discover_servers()
4345
assert servers == []
4446

4547

4648
@pytest.mark.integration
47-
def test_mcp_discover_servers_real_discovery() -> None:
49+
def test_mcp_discover_servers_real_discovery(record_property) -> None:
4850
"""Test discovery without mocking."""
51+
record_property("tested-item-id", "SPEC-UTILS-SERVICE")
4952
servers = mcp_discover_servers()
5053
assert isinstance(servers, list)
5154
for server in servers:
@@ -58,17 +61,19 @@ def test_mcp_discover_servers_real_discovery() -> None:
5861

5962

6063
@pytest.mark.unit
61-
def test_mcp_create_server() -> None:
64+
def test_mcp_create_server(record_property) -> None:
6265
"""Test server creation."""
66+
record_property("tested-item-id", "SPEC-UTILS-SERVICE")
6367
with patch(PATCH_LOCATE_IMPLEMENTATIONS, return_value=[]):
6468
server = mcp_create_server()
6569
assert isinstance(server, FastMCP)
6670
assert server.name == MCP_SERVER_NAME
6771

6872

6973
@pytest.mark.unit
70-
def test_mcp_create_server_mounts_discovered() -> None:
74+
def test_mcp_create_server_mounts_discovered(record_property) -> None:
7175
"""Test that mcp_create_server mounts discovered servers with their tools."""
76+
record_property("tested-item-id", "SPEC-UTILS-SERVICE")
7277
plugin1 = FastMCP("plugin1")
7378
plugin2 = FastMCP("plugin2")
7479

@@ -100,8 +105,9 @@ def plugin2_tool() -> str:
100105

101106

102107
@pytest.mark.unit
103-
def test_mcp_create_server_skips_duplicate_names(caplog: pytest.LogCaptureFixture) -> None:
108+
def test_mcp_create_server_skips_duplicate_names(caplog: pytest.LogCaptureFixture, record_property) -> None:
104109
"""Test that servers with duplicate names are skipped with warning."""
110+
record_property("tested-item-id", "SPEC-UTILS-SERVICE")
105111
dup1 = FastMCP("duplicate_name")
106112
dup2 = FastMCP("duplicate_name")
107113
unique = FastMCP("unique_name")
@@ -144,8 +150,9 @@ def unique_tool() -> str:
144150

145151

146152
@pytest.mark.unit
147-
def test_mcp_list_tools_returns_tool_info() -> None:
153+
def test_mcp_list_tools_returns_tool_info(record_property) -> None:
148154
"""Test that mcp_list_tools returns correct tool information."""
155+
record_property("tested-item-id", "SPEC-UTILS-SERVICE")
149156
test_server = FastMCP("test")
150157

151158
@test_server.tool
@@ -161,8 +168,9 @@ def test_tool(param: str) -> str:
161168

162169

163170
@pytest.mark.unit
164-
def test_mcp_list_tools_empty() -> None:
171+
def test_mcp_list_tools_empty(record_property) -> None:
165172
"""Test mcp_list_tools with no discovered tools."""
173+
record_property("tested-item-id", "SPEC-UTILS-SERVICE")
166174
with patch(PATCH_LOCATE_IMPLEMENTATIONS, return_value=[]):
167175
tools = mcp_list_tools()
168176
# Should return empty list when no plugins have tools

0 commit comments

Comments
 (0)