Skip to content
Myr

test_session_interface.py

This file

Path

tests/test_session_interface.py

28 lines · 784 bytes · Python

Last changed by

merge app and request context (#5812)David Lordbefore adoptionadf3636

History of this file

Take it

The walk stopped after 200 commits: lines older than 795d3e2 point at it.

Merge branch '2.2.x'David Lordbefore adoption795d3e2

line 1why, one step back
1import flask

merge app and request context (#5812)David Lordbefore adoptionadf3636

line 2why, one step back
2from flask.globals import app_ctx

Merge branch '2.2.x'David Lordbefore adoption795d3e2

lines 3–16why, one step back
3from flask.sessions import SessionInterface
456def test_open_session_with_endpoint():7 """If request.endpoint (or other URL matching behavior) is needed8 while loading the session, RequestContext.match_request() can be9 called manually.10 """1112 class MySessionInterface(SessionInterface):13 def save_session(self, app, session, response):14 pass1516 def open_session(self, app, request):

merge app and request context (#5812)David Lordbefore adoptionadf3636

line 17why, one step back
17 app_ctx.match_request()

Merge branch '2.2.x'David Lordbefore adoption795d3e2

lines 18–28why, one step back
18 assert request.endpoint is not None
1920 app = flask.Flask(__name__)21 app.session_interface = MySessionInterface()2223 @app.get("/")24 def index():25 return "Hello, World!"2627 response = app.test_client().get("/")28 assert response.status_code == 200