Exemplo n.º 1
0
async def test_after_this_request() -> None:
    async with RequestContext(
            Quart(__name__),
            Request('GET', 'http', '/', CIMultiDict()),
    ) as context:
        after_this_request(lambda: 'hello')
        assert context._after_request_functions[0]() == 'hello'
Exemplo n.º 2
0
async def test_after_this_request() -> None:
    app = Quart(__name__)
    headers, path, query_string = make_test_headers_path_and_query_string(app, '/')
    async with RequestContext(
            Quart(__name__),
            Request('GET', 'http', path, query_string, headers),
    ) as context:
        after_this_request(lambda: 'hello')
        assert context._after_request_functions[0]() == 'hello'
Exemplo n.º 3
0
async def test_after_this_request() -> None:
    app = Quart(__name__)
    headers, path, query_string = make_test_headers_path_and_query_string(app, "/")
    async with RequestContext(
        Quart(__name__),
        Request(
            "GET", "http", path, query_string, headers, "", "1.1", send_push_promise=no_op_push
        ),
    ) as context:
        after_this_request(lambda: "hello")
        assert context._after_request_functions[0]() == "hello"