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

Method test_execute

tests/commands/definitions/test_clear_command.py:24–41  ·  view source on GitHub ↗

Test executing the clear command.

(self, command)

Source from the content-addressed store, hash-verified

22
23 @pytest.mark.asyncio
24 async def test_execute(self, command):
25 """Test executing the clear command."""
26 with patch("chuk_term.ui.clear_screen") as mock_clear:
27 with patch("chuk_term.ui.display_chat_banner") as mock_banner:
28 # Mock get_context from the context module
29 with patch("mcp_cli.context.get_context") as mock_context:
30 mock_context.return_value = None
31
32 result = await command.execute()
33
34 # Verify clear_screen was called
35 mock_clear.assert_called_once()
36 # Banner should not be called when no context
37 mock_banner.assert_not_called()
38
39 # Check result
40 assert result.success is True
41 assert result.should_clear is False # We handle clearing internally
42
43 @pytest.mark.asyncio
44 async def test_execute_with_context(self, command):

Callers

nothing calls this directly

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected