~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_help.py

  • Committer: Robert Collins
  • Date: 2007-04-20 02:20:05 UTC
  • mto: This revision was merged to the branch mainline in revision 2441.
  • Revision ID: robertc@robertcollins.net-20070420022005-a291lv2j0c18urai
HelpCommandContext now implementes get_topics.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from cStringIO import StringIO
20
20
 
21
21
from bzrlib import (
 
22
    builtins,
22
23
    commands,
23
24
    errors,
24
25
    help,
103
104
    def test_default_constructable(self):
104
105
        context = commands.HelpCommandContext()
105
106
 
 
107
    def test_get_topics_None(self):
 
108
        """Searching for None returns an empty list."""
 
109
        context = commands.HelpCommandContext()
 
110
        self.assertEqual([], context.get_topics(None))
 
111
 
 
112
    def test_get_topics_rocks(self):
 
113
        """Searching for 'rocks' returns the cmd_rocks command instance."""
 
114
        context = commands.HelpCommandContext()
 
115
        topics = context.get_topics('rocks')
 
116
        self.assertEqual(1, len(topics))
 
117
        self.assertIsInstance(topics[0], builtins.cmd_rocks)
 
118
 
 
119
    def test_get_topics_no_topic(self):
 
120
        """Searching for something that is not a command returns []."""
 
121
        context = commands.HelpCommandContext()
 
122
        self.assertEqual([], context.get_topics('nothing by this name'))
 
123
 
106
124
 
107
125
class TestHelpContexts(tests.TestCase):
108
126
    """Tests for the HelpContexts class."""