MCPcopy
hub / github.com/pallets/flask / test_session_error_pops_context

Function test_session_error_pops_context

tests/test_reqctx.py:205–226  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

203
204
205def test_session_error_pops_context():
206 class SessionError(Exception):
207 pass
208
209 class FailingSessionInterface(SessionInterface):
210 def open_session(self, app, request):
211 raise SessionError()
212
213 class CustomFlask(flask.Flask):
214 session_interface = FailingSessionInterface()
215
216 app = CustomFlask(__name__)
217
218 @app.route("/")
219 def index():
220 # shouldn't get here
221 AssertionError()
222
223 response = app.test_client().get("/")
224 assert response.status_code == 500
225 assert not flask.request
226 assert not flask.current_app
227
228
229def test_session_dynamic_cookie_name():

Callers

nothing calls this directly

Calls 3

test_clientMethod · 0.80
CustomFlaskClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected