def test_get_defaults(self): default_config = os.path.join(get_juju_home(), 'juju-qa.s3cfg') args = parse_args(['get', '3275', 'job-foo', 'files-bar']) self.assertEqual(Namespace( command='get', config=default_config, revision_build=3275, job='job-foo', file_pattern='files-bar', workspace='.', verbose=0), args)
def test_get_juju_bin_defaults(self): default_config = os.path.join(get_juju_home(), 'juju-qa.s3cfg') args = parse_args(['get-juju-bin', '3275']) self.assertEqual(Namespace( command='get-juju-bin', config=default_config, revision_build=3275, workspace='.', verbose=0), args)
def test_get_juju_bin_defaults(self): default_config = os.path.join(get_juju_home(), 'juju-qa.s3cfg') args = parse_args(['get-juju-bin', '3275']) self.assertEqual( Namespace(command='get-juju-bin', config=default_config, revision_build=3275, workspace='.', verbose=0), args)
def test_get_defaults(self): default_config = os.path.join(get_juju_home(), 'juju-qa.s3cfg') args = parse_args(['get', '3275', 'job-foo', 'files-bar']) self.assertEqual( Namespace(command='get', config=default_config, revision_build=3275, job='job-foo', file_pattern='files-bar', workspace='.', verbose=0), args)
def test_get_verbosity(self): args = parse_args(['get', '3275', 'job-foo', 'files-bar', '-v']) self.assertEqual(1, args.verbose) args = parse_args(['get', '3275', 'job-foo', 'files-bar', '-vv']) self.assertEqual(2, args.verbose)
def test_get_too_few(self): with parse_error(self) as stderr: parse_args(['get', '3275', 'job-foo']) self.assertRegexpMatches(stderr.getvalue(), 'too few arguments$')
def test_get_workspace(self): args = parse_args( ['get', '3275', 'job-foo', 'files-bar', 'myworkspace']) self.assertEqual('myworkspace', args.workspace)
def test_get_juju_bin_verbosity(self): args = parse_args(['get-juju-bin', '3275', '-v']) self.assertEqual(1, args.verbose) args = parse_args(['get-juju-bin', '3275', '-vv']) self.assertEqual(2, args.verbose)
def test_get_juju_bin_too_few(self): with parse_error(self) as stderr: parse_args(['get-juju-bin']) self.assertRegexpMatches(stderr.getvalue(), 'too few arguments$')
def test_get_juju_bin_workspace(self): args = parse_args(['get-juju-bin', '3275', 'myworkspace']) self.assertEqual('myworkspace', args.workspace)
def test_get_workspace(self): args = parse_args(['get', '3275', 'job-foo', 'files-bar', 'myworkspace']) self.assertEqual('myworkspace', args.workspace)