~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_help.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-10-05 21:15:13 UTC
  • mfrom: (5448.3.5 374700-Add-gnu-lsh-support)
  • Revision ID: pqm@pqm.ubuntu.com-20101005211513-whouyj5t7oo92gmq
(gz) Add support for GNU lsh as a secure shell client (Matthew Gordon)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2009-2012, 2016 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
19
19
"""
20
20
 
21
21
 
22
 
from bzrlib import (
23
 
    config,
24
 
    i18n,
25
 
    tests,
26
 
    )
27
 
 
28
 
from bzrlib.tests.test_i18n import ZzzTranslations
29
 
 
30
 
 
31
 
class TestHelp(tests.TestCaseWithTransport):
 
22
import bzrlib
 
23
from bzrlib import config
 
24
from bzrlib.tests import TestCaseWithTransport
 
25
 
 
26
 
 
27
class TestHelp(TestCaseWithTransport):
32
28
 
33
29
    def test_help_basic(self):
34
30
        for cmd in ['--help', 'help', '-h', '-?']:
103
99
        long_help  = self.run_bzr('help --long')[0]
104
100
        qmark_long = self.run_bzr('? --long')[0]
105
101
        qmark_cmds = self.run_bzr('? commands')[0]
106
 
        self.assertEqual(dash_help, commands)
107
 
        self.assertEqual(dash_help, long_help)
108
 
        self.assertEqual(dash_help, qmark_long)
109
 
        self.assertEqual(dash_help, qmark_cmds)
110
 
 
111
 
    def test_help_width_zero(self):
112
 
        self.overrideEnv('BZR_COLUMNS', '0')
113
 
        self.run_bzr('help commands')
 
102
        self.assertEquals(dash_help, commands)
 
103
        self.assertEquals(dash_help, long_help)
 
104
        self.assertEquals(dash_help, qmark_long)
 
105
        self.assertEquals(dash_help, qmark_cmds)
114
106
 
115
107
    def test_hidden(self):
116
108
        help_commands = self.run_bzr('help commands')[0]
138
130
    def test_help_detail(self):
139
131
        dash_h  = self.run_bzr('diff -h')[0]
140
132
        help_x  = self.run_bzr('help diff')[0]
141
 
        self.assertEqual(dash_h, help_x)
 
133
        self.assertEquals(dash_h, help_x)
142
134
        self.assertContainsRe(help_x, "Purpose:")
143
135
        self.assertContainsRe(help_x, "Usage:")
144
136
        self.assertContainsRe(help_x, "Options:")
160
152
    def test_help_help(self):
161
153
        help = self.run_bzr('help help')[0]
162
154
        qmark = self.run_bzr('? ?')[0]
163
 
        self.assertEqual(help, qmark)
 
155
        self.assertEquals(help, qmark)
164
156
        for line in help.split('\n'):
165
157
            if '--long' in line:
166
158
                self.assertContainsRe(line,
179
171
 
180
172
        self.assertEqual("'bzr c' is an alias for 'bzr cat'.\n",
181
173
                         self.run_bzr('help c')[0])
182
 
 
183
 
 
184
 
class TestTranslatedHelp(tests.TestCaseWithTransport):
185
 
    """Tests for display of translated help topics"""
186
 
 
187
 
    def setUp(self):
188
 
        super(TestTranslatedHelp, self).setUp()
189
 
        self.overrideAttr(i18n, '_translations', ZzzTranslations())
190
 
 
191
 
    def test_help_command_utf8(self):
192
 
        out, err = self.run_bzr(["help", "push"], encoding="utf-8")
193
 
        self.assertContainsRe(out, "zz\xc3\xa5{{:See also:")
194
 
 
195
 
    def test_help_switch_utf8(self):
196
 
        out, err = self.run_bzr(["push", "--help"], encoding="utf-8")
197
 
        self.assertContainsRe(out, "zz\xc3\xa5{{:See also:")
198
 
 
199
 
    def test_help_command_ascii(self):
200
 
        out, err = self.run_bzr(["help", "push"], encoding="ascii")
201
 
        self.assertContainsRe(out, "zz\\?{{:See also:")
202
 
 
203
 
    def test_help_switch_ascii(self):
204
 
        out, err = self.run_bzr(["push", "--help"], encoding="ascii")
205
 
        self.assertContainsRe(out, "zz\\?{{:See also:")