def METHOD_NAME(self):
    def create_invoker_and_load_cmds_and_args(cli):
        cli.invocation = mock.MagicMock()
        cli.invocation.commands_loader = mock.MagicMock()
        cli.invocation.commands_loader.command_table = self.cmd_table = {}
        for cmd in ['foo command_1', 'foo command_2', 'bar command_1', 'bar command_2', 'foobar']:
            self.cmd_table[cmd] = AzCliCommand(cli.invocation.commands_loader, cmd, lambda: None)
        for cmd in ['bar command_1', 'bar command_2']:
            self.cmd_table[cmd].command_source = ExtensionCommandSource(extension_name='bar')
            self.cmd_table[cmd].command_source.extension_name = 'bar'
        for cmd in ['foo command_1', 'foo command_2']:
            self.cmd_table[cmd].command_source = mock.MagicMock()
            self.cmd_table[cmd].command_source = 'foo'
    def get_command_modules_paths(**_):
        return [(mod, os.path.dirname(__file__)) for mod in ('foo', 'drool')]
    def get_all_help(_):
        for cmd in self.cmd_table:
            cmd_help = mock.MagicMock()
            cmd_help.command = cmd
            yield cmd_help
    self.patches = []
    self.patches.append(mock.patch('azure.cli.core.get_default_cli', mock.MagicMock))
    self.patches.append(mock.patch('azure.cli.core.file_util.get_all_help', get_all_help))
    self.patches.append(mock.patch('azure.cli.core.file_util.create_invoker_and_load_cmds_and_args',
                                   create_invoker_and_load_cmds_and_args))
    self.patches.append(mock.patch('automation.utilities.path.get_command_modules_paths',
                                   get_command_modules_paths))
    self.patches.append(mock.patch('knack.cli.CLI', mock.MagicMock))
    self.patches.append(mock.patch('sys.exit', lambda _: None))
    for patch in self.patches:
        patch.start()