MCPcopy Create free account
hub / github.com/pallets/flask / test_missing_session

Function test_missing_session

tests/test_basic.py:361–371  ·  view source on GitHub ↗
(app)

Source from the content-addressed store, hash-verified

359
360
361def test_missing_session(app):
362 app.secret_key = None
363
364 def expect_exception(f, *args, **kwargs):
365 e = pytest.raises(RuntimeError, f, *args, **kwargs)
366 assert e.value.args and "session is unavailable" in e.value.args[0]
367
368 with app.test_request_context():
369 assert flask.session.get("missing_key") is None
370 expect_exception(flask.session.__setitem__, "foo", 42)
371 expect_exception(flask.session.pop, "foo")
372
373
374def test_session_secret_key_fallbacks(app, client) -> None:

Callers

nothing calls this directly

Calls 3

expect_exceptionFunction · 0.85
test_request_contextMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected