def test_werkzeug_http_error_custom_message():
"""
Custom error messages are returned.
"""
graph = create_object_graph(name="example", testing=True)
@graph.app.route("/why_me")
@graph.audit
def why_me():
raise InternalServerError("Why me?")
client = graph.app.test_client()
response = client.get("/why_me")
assert_that(response.status_code, is_(equal_to(500)))
data = loads(response.get_data().decode("utf-8"))
assert_that(data, is_(equal_to({
"code": 500,
"message": "Why me?",
"retryable": False,
"context": {"errors": []},
})))
评论列表
文章目录