Beispiel #1
0
def fixture_current_cookie(with_user, session_id):
    user_id = with_user[0]
    cookie_name = login.auth_cookie_name()
    cookie_value = login._auth_cookie_value(user_id, session_id)

    environ = dict(create_environ(),
                   HTTP_COOKIE=f"{cookie_name}={cookie_value}".encode("utf-8"))

    with application_and_request_context(environ):
        yield cookie_name
Beispiel #2
0
def fixture_current_cookie(with_user, session_id):
    user_id = with_user[0]
    cookie_name = login.auth_cookie_name()
    cookie_value = login._auth_cookie_value(user_id, session_id)

    environ = dict(create_environ(), HTTP_COOKIE=f"{cookie_name}={cookie_value}".encode("utf-8"))

    with AppContext(DummyApplication(environ, None)), \
            RequestContext(htmllib.html(http.Request(environ))):
        yield cookie_name