def test_validation_fails_on_missing_basic_auth_value(self): for key in ('username', 'password'): with self.subTest(value=key): test_dict = TeamCredentialTest.create_valid_test_dictionary() test_dict.pop(key) element = examinee.ConcourseTeamCredentials(test_dict) with self.assertRaises(ModelValidationError): element.validate()
def test_validation_fails_on_invalid_github_oauth_teamname(self): for value in ('foo/bar/baz', '/foo', 'bar/', 'baz'): with self.subTest(value=value): test_dict = TeamCredentialTest.create_valid_test_dictionary() test_dict['gitAuthTeam'] = value element = examinee.ConcourseTeamCredentials(test_dict) with self.assertRaises(ModelValidationError): element.validate()
def test_validation_fails_on_missing_github_oauth_value(self): for key in ('gitAuthTeam', 'githubAuthClientId', 'githubAuthClientSecret'): with self.subTest(value=key): test_dict = TeamCredentialTest.create_valid_test_dictionary() test_dict.pop(key) element = examinee.ConcourseTeamCredentials(test_dict) with self.assertRaises(ModelValidationError): element.validate()
def test_git_auth_team_getter(self): test_object = examinee.ConcourseTeamCredentials(self.raw_dict) org, team = test_object.github_auth_team(split=True) self.assertEqual(org, 'foo') self.assertEqual(team, 'bar') org_team = test_object.github_auth_team(split=False) self.assertEqual(org_team, 'foo:bar')
def test_validation_fails_on_missing_teamname(self): self.raw_dict.pop('teamname') element = examinee.ConcourseTeamCredentials(self.raw_dict) with self.assertRaises(ModelValidationError): element.validate()
def test_validation_fails_on_empty_dict(self): raw_dict = {} with self.assertRaises(ModelValidationError): examinee.ConcourseTeamCredentials(raw_dict).validate()
def test_team_credentials_complete_github_oauth_detected(self): test_object = examinee.ConcourseTeamCredentials(self.raw_dict) self.assertTrue(test_object.has_github_oauth_credentials())