~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_help.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-09 12:34:00 UTC
  • mfrom: (6056.2.5 option-registry)
  • Revision ID: pqm@pqm.ubuntu.com-20110809123400-x521f2j9jkxx8ze2
(vila) Introduce OptionRegistry (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from bzrlib import (
22
22
    builtins,
23
23
    commands,
24
 
    config,
25
24
    errors,
26
25
    help,
27
26
    help_topics,
562
561
        self.assertEqual('', index.prefix)
563
562
 
564
563
 
565
 
class TestConfigOptionIndex(TestHelp):
566
 
    """Tests for the HelpCommandIndex class."""
567
 
 
568
 
    def setUp(self):
569
 
        super(TestConfigOptionIndex, self).setUp()
570
 
        self.index = help_topics.ConfigOptionHelpIndex()
571
 
 
572
 
    def test_get_topics_None(self):
573
 
        """Searching for None returns an empty list."""
574
 
        self.assertEqual([], self.index.get_topics(None))
575
 
 
576
 
    def test_get_topics_no_topic(self):
577
 
        self.assertEqual([], self.index.get_topics('nothing by this name'))
578
 
 
579
 
    def test_prefix(self):
580
 
        self.assertEqual('configuration/', self.index.prefix)
581
 
 
582
 
    def test_get_topic_with_prefix(self):
583
 
        topics = self.index.get_topics('configuration/default_format')
584
 
        self.assertLength(1, topics)
585
 
        opt = topics[0]
586
 
        self.assertIsInstance(opt, config.Option)
587
 
        self.assertEquals('default_format', opt.name)
588
 
 
589
 
 
590
564
class TestCommandIndex(TestHelp):
591
565
    """Tests for the HelpCommandIndex class."""
592
566
 
629
603
    def test_default_search_path(self):
630
604
        """The default search path should include internal indexs."""
631
605
        indices = help.HelpIndices()
632
 
        self.assertEqual(4, len(indices.search_path))
 
606
        self.assertEqual(3, len(indices.search_path))
633
607
        # help topics should be searched in first.
634
608
        self.assertIsInstance(indices.search_path[0],
635
 
                              help_topics.HelpTopicIndex)
 
609
            help_topics.HelpTopicIndex)
636
610
        # with commands being search second.
637
611
        self.assertIsInstance(indices.search_path[1],
638
 
                              commands.HelpCommandIndex)
639
 
        # plugins are a third index.
 
612
            commands.HelpCommandIndex)
 
613
        # and plugins are a third index.
640
614
        self.assertIsInstance(indices.search_path[2],
641
 
                              plugin.PluginsHelpIndex)
642
 
        # config options are a fourth index
643
 
        self.assertIsInstance(indices.search_path[3],
644
 
                              help_topics.ConfigOptionHelpIndex)
 
615
            plugin.PluginsHelpIndex)
645
616
 
646
617
    def test_search_for_unknown_topic_raises(self):
647
618
        """Searching for an unknown topic should raise NoHelpTopic."""