Beispiel #1
0
async def test_has_request_context() -> None:
    async with RequestContext(Quart(__name__),
                              Request('GET', 'http', '/', CIMultiDict())):
        assert has_request_context() is True
        assert has_app_context() is True
    assert has_request_context() is False
    assert has_app_context() is False
Beispiel #2
0
async def test_has_request_context() -> 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)):
        assert has_request_context() is True
        assert has_app_context() is True
    assert has_request_context() is False
    assert has_app_context() is False
Beispiel #3
0
async def test_has_request_context() -> None:
    app = Quart(__name__)
    headers, path, query_string = make_test_headers_path_and_query_string(app, "/")
    request = Request(
        "GET", "http", path, query_string, headers, "", "1.1", send_push_promise=no_op_push
    )
    async with RequestContext(Quart(__name__), request):
        assert has_request_context() is True
        assert has_app_context() is True
    assert has_request_context() is False
    assert has_app_context() is False