diff options
Diffstat (limited to 'cliff/tests/utils.py')
-rw-r--r-- | cliff/tests/utils.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cliff/tests/utils.py b/cliff/tests/utils.py new file mode 100644 index 0000000..bcab2a2 --- /dev/null +++ b/cliff/tests/utils.py @@ -0,0 +1,30 @@ + +from cliff.command import Command +from cliff.commandmanager import CommandManager + +TEST_NAMESPACE = 'cliff.test' + + +class TestParser(object): + + def print_help(self, stdout): + stdout.write('TestParser') + + +class TestCommand(Command): + + def get_parser(self, ignore): + # Make it look like this class is the parser + # so parse_args() is called. + return TestParser() + + def take_action(self, args): + return + + +class TestCommandManager(CommandManager): + + def load_commands(self, namespace): + if namespace == TEST_NAMESPACE: + for key in ('one', 'two words', 'three word command'): + self.add_command(key, TestCommand) |