mctelnet/tests/test_server.py
Ryan Malloy a8fbd71e0c Initial mctelnet MCP server
Telnet client capabilities for LLMs with expect-style automation:
- Multi-connection management with connection IDs
- Basic send/read operations with auto-response
- expect() for pattern matching across multiple patterns
- expect_send() for classic expect-style interactions
- run_script() for full automation sequences
- Password hiding for sensitive data
2026-02-06 16:59:28 -07:00

39 lines
949 B
Python

"""Tests for mctelnet server."""
import pytest
from mctelnet.server import _connections, mcp
def test_mcp_server_exists():
"""Verify MCP server is configured."""
assert mcp.name == "mctelnet"
def test_tools_registered():
"""Verify all expected tools are registered."""
# Access tools through the tool manager's internal storage
tool_manager = mcp._tool_manager
tool_names = set(tool_manager._tools.keys())
expected_tools = {
"connect",
"send",
"read",
"expect",
"expect_send",
"run_script",
"list_connections",
"disconnect",
"disconnect_all",
}
assert expected_tools.issubset(tool_names), f"Missing tools: {expected_tools - tool_names}"
def test_connection_storage_initially_empty():
"""Verify no connections exist at startup."""
# Clear any lingering connections
_connections.clear()
assert len(_connections) == 0