Skip to content

Commit 29a5e3a

Browse files
committed
Update tests
1 parent d388520 commit 29a5e3a

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

tests/server/fastmcp/test_integration.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from mcp.client.session import ClientSession
2323
from mcp.client.sse import sse_client
2424
from mcp.client.streamable_http import streamablehttp_client
25-
from mcp.server.fastmcp import FastMCP
25+
from mcp.server.fastmcp import Context, FastMCP
2626
from mcp.server.fastmcp.resources import FunctionResource
2727
from mcp.server.transport_security import TransportSecuritySettings
2828
from mcp.shared.context import RequestContext
@@ -101,10 +101,7 @@ def echo(message: str) -> str:
101101

102102

103103
def make_everything_fastmcp() -> FastMCP:
104-
"""Create a FastMCP server with all features enabled for testing."""
105-
from mcp.server.fastmcp import Context
106-
from mcp.server.transport_security import TransportSecuritySettings
107-
104+
"""Create a FastMCP server with all features enabled for testing."""
108105
transport_security = TransportSecuritySettings(
109106
allowed_hosts=["127.0.0.1:*", "localhost:*"],
110107
allowed_origins=["http://127.0.0.1:*", "http://localhost:*"]

tests/server/test_streamable_http_security.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -263,23 +263,6 @@ async def test_streamable_http_security_custom_allowed_hosts(server_port: int):
263263
)
264264
# Should connect successfully with custom host
265265
assert response.status_code == 200
266-
267-
# Test with non-allowed host
268-
headers = {
269-
"Host": "evil.com",
270-
"Accept": "application/json, text/event-stream",
271-
"Content-Type": "application/json",
272-
}
273-
274-
async with httpx.AsyncClient(timeout=5.0) as client:
275-
response = await client.post(
276-
f"http://127.0.0.1:{server_port}/",
277-
json={"jsonrpc": "2.0", "method": "initialize", "id": 1, "params": {}},
278-
headers=headers
279-
)
280-
assert response.status_code == 400, response.text
281-
assert response.text == "Invalid Host header"
282-
283266
finally:
284267
process.terminate()
285268
process.join()

0 commit comments

Comments
 (0)