Esempio n. 1
0
class TestHelpCommand(unittest.TestCase):
    def setUp(self):
        self.all_commands = [HelpCommand, MockCommand]
        self.help_cmd = HelpCommand('mock_cmd')

    def tearDown(self):
        self.help_cmd = None

    def test_help_execute(self):
        help_mock_cmd = self.help_cmd.execute(commands=self.all_commands)
        assert MockCommand.help_info() == MockCommand.help_info()

    @raises(UnknownCommandException)
    def test_unknown_command(self):
        self.help_cmd.execute(commands=[])

    def test_unknown_command_msg(self):
        try:
            self.help_cmd.execute(commands=[])
        except UnknownCommandException, e:
            assert 'Unknown Command: mock_cmd' == e.msg
Esempio n. 2
0
 def setUp(self):
     self.all_commands = [HelpCommand, MockCommand]
     self.help_cmd = HelpCommand('mock_cmd')