Merge "Add unit tests for different help commands"
This commit is contained in:
commit
382af52544
@ -162,17 +162,27 @@ class ShellTest(utils.TestCase):
|
|||||||
for r in required:
|
for r in required:
|
||||||
self.assertIn(r, stderr)
|
self.assertIn(r, stderr)
|
||||||
|
|
||||||
def test_help(self):
|
def _test_help(self, command):
|
||||||
required = [
|
required = [
|
||||||
'.*?^usage: ',
|
'.*?^usage: ',
|
||||||
'.*?^\s+set-password\s+Change the admin password',
|
'.*?^\s+set-password\s+Change the admin password',
|
||||||
'.*?^See "nova help COMMAND" for help on a specific command',
|
'.*?^See "nova help COMMAND" for help on a specific command',
|
||||||
]
|
]
|
||||||
stdout, stderr = self.shell('help')
|
stdout, stderr = self.shell(command)
|
||||||
for r in required:
|
for r in required:
|
||||||
self.assertThat((stdout + stderr),
|
self.assertThat((stdout + stderr),
|
||||||
matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
|
matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
|
||||||
|
|
||||||
|
def test_help(self):
|
||||||
|
self._test_help('help')
|
||||||
|
|
||||||
|
def test_help_option(self):
|
||||||
|
self._test_help('--help')
|
||||||
|
self._test_help('-h')
|
||||||
|
|
||||||
|
def test_help_no_subcommand(self):
|
||||||
|
self._test_help('')
|
||||||
|
|
||||||
def test_help_on_subcommand(self):
|
def test_help_on_subcommand(self):
|
||||||
required = [
|
required = [
|
||||||
'.*?^usage: nova set-password',
|
'.*?^usage: nova set-password',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user