/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 breezy/tests/blackbox/test_help.py

  • Committer: Jelmer Vernooij
  • Date: 2020-03-22 01:35:14 UTC
  • mfrom: (7490.7.6 work)
  • mto: This revision was merged to the branch mainline in revision 7499.
  • Revision ID: jelmer@jelmer.uk-20200322013514-7vw1ntwho04rcuj3
merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
    def test_help_urlspec(self):
67
67
        """Smoke test for 'brz help urlspec'"""
68
68
        out, err = self.run_bzr('help urlspec')
69
 
        self.assertContainsRe(out, 'aftp://')
70
69
        self.assertContainsRe(out, 'bzr://')
71
 
        self.assertContainsRe(out, 'bzr\+ssh://')
 
70
        self.assertContainsRe(out, 'bzr\\+ssh://')
72
71
        self.assertContainsRe(out, 'file://')
73
 
        self.assertContainsRe(out, 'ftp://')
74
72
        self.assertContainsRe(out, 'http://')
75
73
        self.assertContainsRe(out, 'https://')
76
74
        self.assertContainsRe(out, 'sftp://')
97
95
        self.assertEqual(expected, out)
98
96
 
99
97
    def test_help_commands(self):
100
 
        dash_help  = self.run_bzr('--help commands')[0]
101
 
        commands   = self.run_bzr('help commands')[0]
 
98
        dash_help = self.run_bzr('--help commands')[0]
 
99
        commands = self.run_bzr('help commands')[0]
102
100
        hidden = self.run_bzr('help hidden-commands')[0]
103
 
        long_help  = self.run_bzr('help --long')[0]
 
101
        long_help = self.run_bzr('help --long')[0]
104
102
        qmark_long = self.run_bzr('? --long')[0]
105
103
        qmark_cmds = self.run_bzr('? commands')[0]
106
104
        self.assertEqual(dash_help, commands)
123
121
            cmds = []
124
122
            for line in help_output.split('\n'):
125
123
                if line.startswith(' '):
126
 
                    continue # help on more than one line
 
124
                    continue  # help on more than one line
127
125
                cmd = line.split(' ')[0]
128
126
                if line:
129
127
                    cmds.append(cmd)
136
134
        self.assertTrue('rocks' not in commands)
137
135
 
138
136
    def test_help_detail(self):
139
 
        dash_h  = self.run_bzr('diff -h')[0]
140
 
        help_x  = self.run_bzr('help diff')[0]
 
137
        dash_h = self.run_bzr('diff -h')[0]
 
138
        help_x = self.run_bzr('help diff')[0]
141
139
        self.assertEqual(dash_h, help_x)
142
140
        self.assertContainsRe(help_x, "Purpose:")
143
141
        self.assertContainsRe(help_x, "Usage:")
148
146
        self.assertContainsRe(help_x, "Aliases:")
149
147
 
150
148
    def test_help_usage(self):
151
 
        usage  = self.run_bzr('diff --usage')[0]
 
149
        usage = self.run_bzr('diff --usage')[0]
152
150
        self.assertContainsRe(usage, "Purpose:")
153
151
        self.assertContainsRe(usage, "Usage:")
154
152
        self.assertContainsRe(usage, "Options:")
164
162
        for line in help.split('\n'):
165
163
            if '--long' in line:
166
164
                self.assertContainsRe(line,
167
 
                    r'Show help on all commands\.')
 
165
                                      r'Show help on all commands\.')
168
166
 
169
167
    def test_help_with_aliases(self):
170
168
        original = self.run_bzr('help cat')[0]
189
187
        self.overrideAttr(i18n, '_translations', ZzzTranslations())
190
188
 
191
189
    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:")
 
190
        out, err = self.run_bzr_raw(["help", "push"], encoding="utf-8")
 
191
        self.assertContainsRe(out, b"zz\xc3\xa5{{:See also:")
194
192
 
195
193
    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:")
 
194
        out, err = self.run_bzr_raw(["push", "--help"], encoding="utf-8")
 
195
        self.assertContainsRe(out, b"zz\xc3\xa5{{:See also:")
198
196
 
199
197
    def test_help_command_ascii(self):
200
 
        out, err = self.run_bzr(["help", "push"], encoding="ascii")
201
 
        self.assertContainsRe(out, "zz\\?{{:See also:")
 
198
        out, err = self.run_bzr_raw(["help", "push"], encoding="ascii")
 
199
        self.assertContainsRe(out, b"zz\\?{{:See also:")
202
200
 
203
201
    def test_help_switch_ascii(self):
204
 
        out, err = self.run_bzr(["push", "--help"], encoding="ascii")
205
 
        self.assertContainsRe(out, "zz\\?{{:See also:")
 
202
        out, err = self.run_bzr_raw(["push", "--help"], encoding="ascii")
 
203
        self.assertContainsRe(out, b"zz\\?{{:See also:")