Skip to content

Commit 25b3a7b

Browse files
committed
Test refactoring
1 parent 8dfa25b commit 25b3a7b

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

tests/client/config/test_mcp_servers_config.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ def mcp_config_file(tmp_path: Path) -> Path:
4747
"streamable_http_server_with_explicit_type": {
4848
"type": "streamable_http", # Explicitly specified
4949
"url": "https://api.example.com/mcp",
50-
"headers": {"Authorization": "Bearer token123"},
5150
},
5251
"sse_server_with_explicit_type": {
5352
"type": "sse", # Explicitly specified
5453
"url": "https://api.example.com/sse",
55-
"headers": {"Authorization": "Bearer token456"},
5654
},
5755
}
5856
}
@@ -84,36 +82,31 @@ def test_stdio_server(mcp_config_file: Path):
8482
assert stdio_server.effective_args == ["-m", "my_server"]
8583

8684

87-
def test_explicit_types_are_respected(mcp_config_file: Path):
88-
"""Test that explicit 'type' fields in JSON config are respected and work correctly."""
85+
def test_stdio_server_with_explicit_type(mcp_config_file: Path):
86+
"""Test that stdio server with explicit 'type' field is respected and works correctly."""
8987
config = MCPServersConfig.from_file(mcp_config_file)
9088

91-
# Test that servers are parsed correctly with explicit types
92-
assert "stdio_server_with_explicit_type" in config.servers
93-
assert "streamable_http_server_with_explicit_type" in config.servers
94-
assert "sse_server_with_explicit_type" in config.servers
95-
96-
# Test stdio server with explicit type
9789
stdio_server = config.servers["stdio_server_with_explicit_type"]
9890
assert isinstance(stdio_server, StdioServerConfig)
9991
assert stdio_server.type == "stdio"
100-
assert stdio_server.command == "python"
101-
assert stdio_server.args == ["-m", "my_server"]
102-
assert stdio_server.env == {"DEBUG": "true"}
103-
104-
# Test HTTP server with explicit type
92+
93+
94+
def test_streamable_http_server_with_explicit_type(mcp_config_file: Path):
95+
"""Test that streamable HTTP server with explicit 'type' field is respected and works correctly."""
96+
config = MCPServersConfig.from_file(mcp_config_file)
97+
10598
http_server = config.servers["streamable_http_server_with_explicit_type"]
10699
assert isinstance(http_server, StreamableHttpConfig)
107100
assert http_server.type == "streamable_http"
108-
assert http_server.url == "https://api.example.com/mcp"
109-
assert http_server.headers == {"Authorization": "Bearer token123"}
110101

111-
# Test SSE server with explicit type
102+
103+
def test_sse_server_with_explicit_type(mcp_config_file: Path):
104+
"""Test that SSE server with explicit 'type' field is respected and works correctly."""
105+
config = MCPServersConfig.from_file(mcp_config_file)
106+
112107
sse_server = config.servers["sse_server_with_explicit_type"]
113108
assert isinstance(sse_server, SSEServerConfig)
114109
assert sse_server.type == "sse"
115-
assert sse_server.url == "https://api.example.com/sse"
116-
assert sse_server.headers == {"Authorization": "Bearer token456"}
117110

118111

119112
def test_stdio_server_with_full_command_should_be_split(mcp_config_file: Path):

0 commit comments

Comments
 (0)