summaryrefslogtreecommitdiff
path: root/cliff/tests/utils.py
blob: bcab2a23bdf18d739e261e36bc55bbffa8220954 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)