Skip to main content
Glama
by frap129
test_cli_basic.py1.89 kB
"""Tests for CLI interface.""" from click.testing import CliRunner from lorekeeper_mcp.cli import cli def test_cli_help() -> None: """Test CLI --help output.""" runner = CliRunner() result = runner.invoke(cli, ["--help"]) assert result.exit_code == 0 assert "LoreKeeper MCP" in result.output assert "Options:" in result.output def test_cli_version() -> None: """Test CLI --version output.""" runner = CliRunner() result = runner.invoke(cli, ["--version"]) assert result.exit_code == 0 assert "0.1.0" in result.output def test_import_command_missing_file() -> None: """Test import command with non-existent file.""" runner = CliRunner() result = runner.invoke(cli, ["import", "nonexistent.orcbrew"]) assert result.exit_code != 0 assert "does not exist" in result.output.lower() or "not found" in result.output.lower() def test_import_command_help() -> None: """Test import command --help.""" runner = CliRunner() result = runner.invoke(cli, ["import", "--help"]) assert result.exit_code == 0 assert "import" in result.output.lower() assert "--dry-run" in result.output def test_main_routing_logic() -> None: """Test __main__.py routing logic between CLI and server mode. The __main__.py module routes to: - Server mode (mcp.run()) when no arguments provided - CLI mode (cli.main()) when arguments provided This behavior is implicitly tested by: - test_import_command_* tests verify CLI routing works - test_serve_command_* tests verify server can be started via CLI - The routing logic in __main__.py is simple: len(sys.argv) > 1 """ # This is a documentation test - the routing logic is proven by other tests # Direct testing would require subprocess calls which are fragile # The actual routing code is 4 lines and visually verifiable

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/frap129/lorekeeper-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server