def __init__(self): self.search_path = [ help_topics.HelpTopicIndex(), _mod_commands.HelpCommandIndex(), plugin.PluginsHelpIndex(), help_topics.ConfigOptionHelpIndex(), ]
def test_skipped_on_HelpCommandIndex_get_topics(self): # The get_missing_command(cmd_name) hook is not fired when # looking up help topics. self.hook_missing() topic = commands.HelpCommandIndex() topics = topic.get_topics('foo') self.assertEqual([], self.hook_calls)
def test_get_topic_with_prefix(self): """Searching for commands/rocks returns the rocks command object.""" index = commands.HelpCommandIndex() topics = index.get_topics('commands/rocks') self.assertEqual(1, len(topics)) self.assertIsInstance(topics[0], builtins.cmd_rocks)
def test_prefix(self): """CommandIndex has a prefix of 'commands/'.""" index = commands.HelpCommandIndex() self.assertEqual('commands/', index.prefix)
def test_get_topics_no_topic(self): """Searching for something that is not a command returns [].""" index = commands.HelpCommandIndex() self.assertEqual([], index.get_topics('nothing by this name'))
def test_get_topics_rocks(self): """Searching for 'rocks' returns the cmd_rocks command instance.""" index = commands.HelpCommandIndex() topics = index.get_topics('rocks') self.assertEqual(1, len(topics)) self.assertIsInstance(topics[0], builtins.cmd_rocks)
def test_get_topics_None(self): """Searching for None returns an empty list.""" index = commands.HelpCommandIndex() self.assertEqual([], index.get_topics(None))
def test_default_constructable(self): index = commands.HelpCommandIndex()