Skip to content

Commit 7025771

Browse files
niechenclaude
andcommitted
test: add assertion for add_server method call in client edit test
- Enhanced test_client_edit_non_interactive_add_server to verify that client_manager.add_server is called with the correct server configuration - Added detailed validation of the server config parameters: - Server name with proper mcpm_ prefix - Command set to "mcpm" - Args set to ["run", "test-server"] - Ensures the add operation is actually triggered as intended - Provides comprehensive verification of non-interactive add server workflow 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 5ecd958 commit 7025771

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/test_client.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ def test_client_edit_non_interactive_add_server(monkeypatch):
413413
mock_client_manager.config_path = "/path/to/config.json"
414414
mock_client_manager.get_servers.return_value = {}
415415
mock_client_manager.update_servers.return_value = None
416+
mock_client_manager.add_server.return_value = None
416417

417418
monkeypatch.setattr("mcpm.commands.client.ClientRegistry.get_client_manager", Mock(return_value=mock_client_manager))
418419
monkeypatch.setattr("mcpm.commands.client.ClientRegistry.get_client_info", Mock(return_value={"name": "Cursor"}))
@@ -434,7 +435,16 @@ def test_client_edit_non_interactive_add_server(monkeypatch):
434435

435436
assert result.exit_code == 0
436437
assert "Successfully updated" in result.output
437-
# We can see from the output that the operation was successful
438+
439+
# Verify that add_server was called with the prefixed server name
440+
mock_client_manager.add_server.assert_called()
441+
# Check that add_server was called with a server config for the prefixed server name
442+
call_args = mock_client_manager.add_server.call_args
443+
assert call_args is not None
444+
server_config = call_args[0][0] # First positional argument
445+
assert server_config.name == "mcpm_test-server"
446+
assert server_config.command == "mcpm"
447+
assert server_config.args == ["run", "test-server"]
438448

439449

440450
def test_client_edit_non_interactive_remove_server(monkeypatch):

0 commit comments

Comments
 (0)