|
5 | 5 |
|
6 | 6 | from pyfakefs.fake_filesystem import FakeFilesystem |
7 | 7 |
|
8 | | -from cycode.cli.apps.ai_guardrails.scan.claude_config import get_mcp_servers, get_user_email, load_claude_config |
| 8 | +from cycode.cli.apps.ai_guardrails.scan.claude_config import get_user_email, load_claude_config |
9 | 9 |
|
10 | 10 |
|
11 | 11 | def test_load_claude_config_valid(fs: FakeFilesystem) -> None: |
@@ -52,68 +52,3 @@ def test_get_user_email_missing_email_address() -> None: |
52 | 52 | """Test extracting email when oauthAccount exists but emailAddress is missing.""" |
53 | 53 | config = {'oauthAccount': {'someOtherField': 'value'}} |
54 | 54 | assert get_user_email(config) is None |
55 | | - |
56 | | - |
57 | | -def test_get_mcp_servers_stdio_and_http() -> None: |
58 | | - """Test extracting MCP servers with both stdio and http types.""" |
59 | | - config = { |
60 | | - 'mcpServers': { |
61 | | - 'gitlab': { |
62 | | - 'type': 'stdio', |
63 | | - 'command': '/opt/homebrew/bin/gitlab-mcp', |
64 | | - 'args': ['--verbose'], |
65 | | - }, |
66 | | - 'atlassian': { |
67 | | - 'type': 'http', |
68 | | - 'url': 'https://mcp.atlassian.com/v1/mcp', |
69 | | - }, |
70 | | - }, |
71 | | - } |
72 | | - |
73 | | - result = get_mcp_servers(config) |
74 | | - assert len(result) == 2 |
75 | | - |
76 | | - gitlab = next(s for s in result if s['name'] == 'gitlab') |
77 | | - assert gitlab['server_type'] == 'Local' |
78 | | - assert gitlab['command'] == '/opt/homebrew/bin/gitlab-mcp' |
79 | | - assert gitlab['args'] == ['--verbose'] |
80 | | - assert gitlab['url'] is None |
81 | | - |
82 | | - atlassian = next(s for s in result if s['name'] == 'atlassian') |
83 | | - assert atlassian['server_type'] == 'Remote' |
84 | | - assert atlassian['command'] is None |
85 | | - assert atlassian['url'] == 'https://mcp.atlassian.com/v1/mcp' |
86 | | - |
87 | | - |
88 | | -def test_get_mcp_servers_empty() -> None: |
89 | | - """Test extracting MCP servers when mcpServers is empty.""" |
90 | | - config = {'mcpServers': {}} |
91 | | - assert get_mcp_servers(config) == [] |
92 | | - |
93 | | - |
94 | | -def test_get_mcp_servers_missing_key() -> None: |
95 | | - """Test extracting MCP servers when mcpServers key is missing.""" |
96 | | - config = {'someOtherKey': 'value'} |
97 | | - assert get_mcp_servers(config) == [] |
98 | | - |
99 | | - |
100 | | -def test_get_mcp_servers_invalid_type() -> None: |
101 | | - """Test extracting MCP servers when mcpServers is not a dict.""" |
102 | | - config = {'mcpServers': 'not a dict'} |
103 | | - assert get_mcp_servers(config) == [] |
104 | | - |
105 | | - |
106 | | -def test_get_mcp_servers_unknown_server_type() -> None: |
107 | | - """Test that unknown server types are passed through as-is.""" |
108 | | - config = { |
109 | | - 'mcpServers': { |
110 | | - 'custom': { |
111 | | - 'type': 'sse', |
112 | | - 'url': 'https://example.com/sse', |
113 | | - }, |
114 | | - }, |
115 | | - } |
116 | | - |
117 | | - result = get_mcp_servers(config) |
118 | | - assert len(result) == 1 |
119 | | - assert result[0]['server_type'] == 'sse' |
0 commit comments