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)
test_exceptions.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录