MCPcopy Create free account
hub / github.com/IBM/mcp-cli / MockCLICommand

Class MockCLICommand

tests/adapters/test_cli_adapter_coverage.py:29–88  ·  view source on GitHub ↗

Concrete mock command for CLI-mode testing.

Source from the content-addressed store, hash-verified

27
28
29class MockCLICommand(UnifiedCommand):
30 """Concrete mock command for CLI-mode testing."""
31
32 def __init__(
33 self,
34 test_name: str = "mock",
35 description: str = "Mock CLI command",
36 aliases: list[str] | None = None,
37 requires_ctx: bool = False,
38 hidden: bool = False,
39 parameters: list[CommandParameter] | None = None,
40 help_text: str | None = None,
41 ):
42 super().__init__()
43 self._name = test_name
44 self._description = description
45 self._modes = CommandMode.CLI
46 self._aliases = aliases or []
47 self._requires_context = requires_ctx
48 self._hidden = hidden
49 self._parameters = parameters or []
50 self._help_text = help_text
51 self.execute_mock = AsyncMock(
52 return_value=CommandResult(success=True, output="Mock executed")
53 )
54
55 @property
56 def name(self) -> str:
57 return self._name
58
59 @property
60 def description(self) -> str:
61 return self._description
62
63 @property
64 def modes(self) -> CommandMode:
65 return self._modes
66
67 @property
68 def aliases(self):
69 return self._aliases
70
71 @property
72 def parameters(self):
73 return self._parameters
74
75 @property
76 def requires_context(self):
77 return self._requires_context
78
79 @property
80 def hidden(self):
81 return self._hidden
82
83 @property
84 def help_text(self):
85 return self._help_text
86

Calls

no outgoing calls