def test_4XX_message(self):
status_code = 400
message = json.dumps({"message": "it went bad"}).encode("UTF-8")
headers = {"content-type": "application/json; charset=utf-8"}
with pytest.raises(BadRequest) as exc_info:
sansio.decipher_response(status_code, headers, message)
assert exc_info.value.status_code == http.HTTPStatus(status_code)
assert str(exc_info.value) == "it went bad"
评论列表
文章目录