Пример #1
0
 def test_mailman_command_without_subcommand_prints_help(self, mock):
     # Issue #137: Running `mailman` without a subcommand raises an
     # AttributeError.
     result = self._command.invoke(main)
     lines = result.output.splitlines()
     # "main" instead of "mailman" because of the way the click runner
     # works.  It does actually show the correct program when run from the
     # command line.
     self.assertEqual(lines[0], 'Usage: main [OPTIONS] COMMAND [ARGS]...')
     # The help output includes a list of subcommands, in sorted order.
     commands = {}
     add_components('commands', ICLISubCommand, commands)
     help_commands = list(line.split()[0].strip()
                          for line in lines[-len(commands):])
     self.assertEqual(sorted(commands), help_commands)
Пример #2
0
def initialize():
    """Initialize the pipelines."""
    # Find all handlers in the registered plugins.
    add_components('handlers', IHandler, config.handlers)
    # Set up some pipelines.
    add_components('pipelines', IPipeline, config.pipelines)
Пример #3
0
 def populate(self):
     self._styles.clear()
     add_components('styles', IStyle, self._styles)
Пример #4
0
def initialize():
    """Set up chains, both built-in and from the database."""
    add_components('chains', IChain, config.chains)
Пример #5
0
 def _load(self):
     # Load commands lazily as commands in plugins can only be found after
     # the configuration file is loaded.
     if not self._loaded:
         add_components('commands', ICLISubCommand, self._commands)
         self._loaded = True
Пример #6
0
def initialize():
    """Initialize the email commands."""
    add_components('commands', IEmailCommand, config.commands)
Пример #7
0
def initialize():
    """Find and register all rules in all plugins."""
    # Find rules in plugins.
    add_components('rules', IRule, config.rules)