/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_help.py

  • Committer: Robert Collins
  • Date: 2007-04-20 01:57:10 UTC
  • mto: This revision was merged to the branch mainline in revision 2441.
  • Revision ID: robertc@robertcollins.net-20070420015710-apsxzfznrnpg6x17
Relocate command help onto Command.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
            """A sample command."""
36
36
            _see_also = ['foo', 'bar']
37
37
        cmd = cmd_WithSeeAlso()
38
 
        helpfile = StringIO()
39
 
        help.help_on_command_object(cmd, 'cmd_sample', helpfile)
 
38
        helptext = cmd.get_help_text()
40
39
        self.assertEndsWith(
41
 
            helpfile.getvalue(),
 
40
            helptext,
42
41
            '  -h, --help  show help message\n'
43
42
            '\n'
44
43
            'See also: bar, foo\n')
45
44
 
 
45
    def test_get_help_text(self):
 
46
        """Commands have a get_help_text method which returns their help."""
 
47
        class cmd_Demo(commands.Command):
 
48
            """A sample command."""
 
49
        cmd = cmd_Demo()
 
50
        helptext = cmd.get_help_text()
 
51
        self.assertStartsWith(helptext, 'usage:bzr Demo')
 
52
        self.assertEndsWith(helptext, 'show help message\n')
 
53
    
46
54
 
47
55
class TestRegisteredTopic(tests.TestCase):
48
56
    """Tests for the RegisteredTopic class."""