test_session_interface.py
This file
Path
tests/test_session_interface.py
22 lines · 679 bytes · Python
Last changed by
Merge pull request #3794 from mbpreble/open-session-request-endpoint-noneDavid Lordbefore adoptionfdf5d11
History of this fileTake it
1import flask2from flask.sessions import SessionInterface345def test_open_session_endpoint_not_none():6 # Define a session interface that breaks if request.endpoint is None7 class MySessionInterface(SessionInterface):8 def save_session(self):9 pass1011 def open_session(self, _, request):12 assert request.endpoint is not None1314 def index():15 return "Hello World!"1617 # Confirm a 200 response, indicating that request.endpoint was NOT None18 app = flask.Flask(__name__)19 app.route("/")(index)20 app.session_interface = MySessionInterface()21 response = app.test_client().open("/")22 assert response.status_code == 200