def test_subcommand_get_command_return_value(self, click_mock, functools_mock, options_click_mock): all_commands = {"hi": {"help": "Generates a hello Event", "tags": {}}} command_object_mock = Mock() click_mock.Command.return_value = command_object_mock option_mock = Mock() options_click_mock.Option.return_value = option_mock callback_object_mock = Mock() functools_mock.partial.return_value = callback_object_mock s = EventTypeSubCommand(self.events_lib_mock, "hello", all_commands) s.get_command(None, "hi") click_mock.Command.assert_called_once_with( name="hi", short_help="Generates a hello Event", params=[], callback=callback_object_mock, )
def test_subcommand_get_command_return_value(self, click_mock, functools_mock, options_click_mock): all_commands = {"hi": {"help": "Generates a hello Event", "tags": {}}} command_object_mock = Mock() click_mock.Command.return_value = command_object_mock option_mock = Mock() options_click_mock.Option.return_value = option_mock callback_object_mock = Mock() functools_mock.partial.return_value = callback_object_mock s = EventTypeSubCommand(self.events_lib_mock, "hello", all_commands) s.get_command(None, "hi") click_mock.Command.assert_called_once_with(name="hi", short_help="Generates a hello Event", params=[], callback=callback_object_mock)
def test_subcommand_get_accepts_cmd_name_returns_none(self): subcmd_definition = '{"hello": { "tags : { "world" }}}' s = EventTypeSubCommand(self.events_lib_mock, self.service_cmd_name, subcmd_definition) e = s.get_command(None, "heyyo") self.assertIsNone(e)
def test_subcommand_get_accepts_cmd_name_returns_none(self): subcmd_definition = '{"hello": { "tags : { "world" }}}' s = EventTypeSubCommand(self.events_lib_mock, self.service_cmd_name, subcmd_definition) e = s.get_command(None, "heyyo") self.assertIsNone(e)