mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-21 13:04:18 +02:00
Remove bad test
This commit is contained in:
parent
ee6964221a
commit
bfda92e95c
1 changed files with 0 additions and 55 deletions
|
|
@ -1,11 +1,4 @@
|
|||
from pathlib import Path
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
from typer.testing import CliRunner
|
||||
|
||||
from fastmcp import FastMCP
|
||||
from fastmcp.cli.cli import app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
@ -27,51 +20,3 @@ if __name__ == "__main__":
|
|||
"""
|
||||
)
|
||||
return server_path
|
||||
|
||||
|
||||
def test_cli_run_transport_kwargs():
|
||||
"""Test that transport_kwargs are correctly passed from CLI to server.run()"""
|
||||
runner = CliRunner()
|
||||
|
||||
# Need to mock both the file parsing and the server import
|
||||
with (
|
||||
patch("fastmcp.cli.cli._parse_file_path") as mock_parse_file_path,
|
||||
patch("fastmcp.cli.cli._import_server") as mock_import_server,
|
||||
):
|
||||
# Make _parse_file_path return a fake path and server object
|
||||
mock_parse_file_path.return_value = (Path("fake_server.py"), "mcp")
|
||||
|
||||
# Create a mock server with a mock run method
|
||||
mock_server = FastMCP(name="MockServer")
|
||||
mock_server.run = Mock()
|
||||
|
||||
# Make _import_server return our mock server
|
||||
mock_import_server.return_value = mock_server
|
||||
|
||||
# Run the CLI command with transport_kwargs
|
||||
result = runner.invoke(
|
||||
app,
|
||||
[
|
||||
"run",
|
||||
"fake_server.py",
|
||||
"--transport",
|
||||
"sse",
|
||||
"--host",
|
||||
"127.0.0.1",
|
||||
"--port",
|
||||
"9000",
|
||||
"--log-level",
|
||||
"DEBUG",
|
||||
],
|
||||
)
|
||||
|
||||
# Check that the run method was called with the correct kwargs
|
||||
mock_server.run.assert_called_once_with(
|
||||
transport="sse",
|
||||
host="127.0.0.1",
|
||||
port=9000,
|
||||
log_level="DEBUG",
|
||||
)
|
||||
|
||||
# Check CLI command succeeded
|
||||
assert result.exit_code == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue