test_exceptions.py 文件源码

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

项目:python-gnocchiclient 作者: gnocchixyz 项目源码 文件源码
def test_from_response_keystone_401(self):
        r = models.Response()
        r.status_code = 401
        r.headers['Content-Type'] = "application/json"
        r._content = json.dumps({"error": {
            "message": "The request you have made requires authentication.",
            "code": 401, "title": "Unauthorized"}}
        ).encode('utf-8')
        exc = exceptions.from_response(r)
        self.assertIsInstance(exc, exceptions.Unauthorized)
        self.assertEqual("The request you have made requires authentication.",
                         exc.message)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号