def testInvalidInput(self):
raised = False
try:
self.g.get_user().create_key("Bad key", "xxx")
except github.GithubException as exception:
raised = True
self.assertEqual(exception.status, 422)
self.assertEqual(
exception.data,
{
"errors": [
{
"code": "custom",
"field": "key",
"message": "key is invalid. It must begin with 'ssh-rsa' or 'ssh-dss'. Check that you're copying the public half of the key",
"resource": "PublicKey"
}
],
"message": "Validation Failed"
}
)
self.assertTrue(raised)
评论列表
文章目录