Exceptions.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Repobot 作者: Desgard 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号