Пример #1
0
def test_debug_response(app: App, accept: str, content_type: str):
    app.debug = True

    @app.route("/")
    async def index(req, res):
        raise ValueError("Oops")

    client = create_client(app, 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
Пример #2
0
def test_setter_updates_exception_and_error_middleware(app: App):
    app.debug = True
    assert app.debug is True
    assert app.exception_middleware.debug is True
    assert app.server_error_middleware.debug is True