def testRaiseErrorWithBranchProtectionWithInvalidEnforcementLevel(self):
raised = False
try:
self.repo.protect_branch("master", True, "", ["test"])
except github.GithubException as exception:
raised = True
self.assertEqual(exception.status, 422)
self.assertEqual(
exception.data, {
'documentation_url':
'https://developer.github.com/v3/repos/#enabling-and-disabling-branch-protection',
'message': 'Validation Failed',
'errors': [
{
'field': 'required_status_checks_enforcement_level',
'message': "required_status_checks_enforcement_level enforcement level '%s' is not valid",
'code': 'custom',
'resource': 'ProtectedBranch'
}
]
}
)
self.assertTrue(raised)
评论列表
文章目录