def test_help_no_options(self): required = [ '.*?^usage: ', '.*?^See "magnum help COMMAND" for help on a specific command', ] stdout, stderr = self.shell('') for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def _validate_failure(self): required = [ '%s: ERROR:' % self.in_filename, ] stdout, stderr = self.shell('validate %s' % self.in_filename, exitcodes=[1]) for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def _validate_success(self): required = [ 'SUCCESS!', ] stdout, stderr = self.shell('validate %s' % self.in_filename, exitcodes=[0]) for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help_on_subcommand(self): required = [ '.*?^usage: cinder list', '.*?(?m)^Lists all volumes.', ] help_text = self.shell('help list') for r in required: self.assertThat(help_text, matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help_on_subcommand_mv(self): required = [ '.*?^usage: cinder summary', '.*?(?m)^Get volumes summary.', ] help_text = self.shell('help summary') for r in required: self.assertThat(help_text, matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help_on_subcommand(self): required = [ '.*?^usage: .* quota-list'] stdout, stderr = self.shell('help quota-list') for r in required: self.assertThat( stdout, matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE)) self.assertFalse(stderr)
def test_unique_container_name(self): self.runner.inspect = mock.Mock() self.runner.inspect.return_value = None self.assertEqual('foo', self.runner.unique_container_name('foo')) self.runner.inspect.side_effect = ['exists', 'exists', None] name = self.runner.unique_container_name('foo') name_pattern = '^foo-[a-z0-9]{8}$' self.assertThat(name, matchers.MatchesRegex(name_pattern))
def test_help_on_subcommand(self): required = [ '.*?^usage: karbor plan-create', '.*?^Creates a plan.', ] stdout, stderr = self.shell('help plan-create') for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help(self): required = [ '.*?^usage: ', '.*?^\s+help\s+print detailed help for another command' ] kb_help, stderr = self.shell('help') for r in required: self.assertThat((kb_help + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help_on_subcommand(self, cmd): required = [ '.*?^usage: manila list', '.*?(?m)^List NAS shares with filters.', ] help_text = self.shell(cmd) for r in required: self.assertThat(help_text, matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_bash_completion(self): stdout = self.shell('bash-completion') # just check we have some output required = [ '.*--driver_info', '.*--chassis_uuid', '.*help', '.*node-create', '.*chassis-create' ] for r in required: self.assertThat(stdout, matchers.MatchesRegex(r, self.re_options))
def test_help_on_subcommand(self): required = [ '.*?^usage: sahara plugin-list', '.*?^Print a list of available plugins.', ] stdout, stderr = self.shell('help plugin-list') for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help(self): required = [ r'.*?^usage: ', r'.*?^\s+stop\s+Stop specified container.', r'.*?^See "zun help COMMAND" for help on a specific command', ] stdout, stderr = self.shell('help') for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help_on_subcommand(self): required = [ r'.*?^usage: zun create', r'.*?^Create a container.', r'.*?^Optional arguments:', ] stdout, stderr = self.shell('help create') for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help(self): required = [ '.*?^usage: ', '.*?(?m)^\s+create\s+Add a new volume.', '.*?(?m)^See "cinder help COMMAND" for help on a specific command', ] help_text = self.shell('help') for r in required: self.assertThat(help_text, matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help(self): required = [ '.*?^usage: ', '.*?^\s+create\s+Creates new NAS storage \(NFS or CIFS\).', '.*?(?m)^See "manila help COMMAND" for help on a specific command.', ] help_text = self.shell('help') for r in required: self.assertThat(help_text, matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_update_without_path(self): required = [ '.*?^usage: grafana-dashboards update \[-h\] path', '.*?^grafana-dashboards update: error: (too few arguments|the ' 'following arguments are required: path)', ] stdout, stderr = self.shell('update', exitcodes=[2]) for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_bash_completion(self): stdout, stderr = self.shell('bash-completion') # just check we have some output required = [ '.*uhost-reset-password', '.*--ostype', '.*help', '.*unet-sec-delete', '.*--chargetype' ] for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help_on_subcommand(self): required = [ '.*?^usage: ucloud uhost-image-show', '.*?^show image details', '.*?^Positional arguments:', ] stdout, stderr = self.shell('help uhost-image-show') for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help_no_options(self): required = [ '.*?^usage: ', '.*?^\s+root-password\s+Change the admin password', '.*?^See "nova help COMMAND" for help on a specific command', ] stdout, stderr = self.shell('') for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help_no_options(self): required = [ '.*?^usage: murano', '.*?^\s+package-create\s+Create an application package', '.*?^See "murano help COMMAND" for help on a specific command', ] stdout, stderr = self.shell('') for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help(self): required = [ '.*?^usage: karbor', '.*?^\s+plan-create\s+Creates a plan.', '.*?^See "karbor help COMMAND" for help on a specific command', ] stdout, stderr = self.shell('help') for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help_no_options(self): required = [ '.*?^usage: sahara', '.*?^\s+plugin-list\s+Print a list of available plugins.', '.*?^See "sahara help COMMAND" for help on a specific command', ] stdout, stderr = self.shell('') for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def _validate_invalid_file_or_directory(self, path): required = [ '%s: ERROR: \[Errno 2\] No such file or directory:' % path, ] stdout, stderr = self.shell( 'validate %s' % path, exitcodes=[1]) for r in required: self.assertThat( (stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help_on_subcommand(self): required = [ '.*?^usage: nova root-password', '.*?^Change the admin password', '.*?^Positional arguments:', ] stdout, stderr = self.shell('help root-password') for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_bash_completion(self): stdout, stderr = self.shell('bash-completion') # just check we have some output required = [ '.*--matching', '.*--wrap', '.*help', '.*server-group-delete', '.*--image-with' ] for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_delete_without_path(self): required = [ r".*?^usage: grafana-dashboards delete \[-h\] path", r".*?^grafana-dashboards delete: error: (too few arguments|the " r"following arguments are required: path)", ] stdout, stderr = self.shell("delete", exitcodes=[2]) for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_cell_delete_missing_required_args(self): """Verify that missing required args results in error message.""" expected_responses = [ '.*?^usage: craton cell-delete', '.*?^craton cell-delete: error:.*$', ] stdout, stderr = self.shell('cell-delete') for r in expected_responses: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, self.re_options))
def test_help(self): required = [ '.*?^usage: ', '.*?(?m)^\s+create\s+Creates a volume.', '.*?(?m)^Run "cinder help SUBCOMMAND" for help on a subcommand.', ] help_text = self.shell('help') for r in required: self.assertThat(help_text, matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_validate_directory_success(self): path = os.path.join(os.path.dirname(__file__), '../fixtures/cmd/validate/test0001') required = [ 'SUCCESS!', ] stdout, stderr = self.shell('validate %s' % path, exitcodes=[0]) for r in required: self.assertThat((stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))