def test_debug_response(api: API, accept: str, content_type: str): api.debug = True @api.route("/") async def index(req, res): raise ValueError("Oops") client = api.build_client(raise_server_exceptions=False) r = client.get("/", headers={"accept": accept}) assert r.status_code == 500 assert r.headers["content-type"] == content_type assert 'raise ValueError("Oops")' in r.text
def test_setter_updates_exception_and_error_middleware(api: API): api.debug = True assert api.debug is True assert api.exception_middleware.debug is True assert api.server_error_middleware.debug is True