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