Mock command for testing base functionality.
| 27 | |
| 28 | |
| 29 | class MockCommand(CommandBase): |
| 30 | """Mock command for testing base functionality.""" |
| 31 | |
| 32 | def __init__(self, description="Mock Command", should_fail=False): |
| 33 | super().__init__(description) |
| 34 | self.should_fail = should_fail |
| 35 | self.execute_count = 0 |
| 36 | self.undo_count = 0 |
| 37 | |
| 38 | def execute(self): |
| 39 | self.execute_count += 1 |
| 40 | return not self.should_fail |
| 41 | |
| 42 | def undo(self): |
| 43 | self.undo_count += 1 |
| 44 | return not self.should_fail |
| 45 | |
| 46 | |
| 47 | class TestCommandBase(unittest.TestCase): |
no outgoing calls