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

Function test_session

tests/test_basic.py:234–254  ·  view source on GitHub ↗
(app, client)

Source from the content-addressed store, hash-verified

232
233
234def test_session(app, client):
235 @app.route("/set", methods=["POST"])
236 def set():
237 assert not flask.session.accessed
238 assert not flask.session.modified
239 flask.session["value"] = flask.request.form["value"]
240 assert flask.session.accessed
241 assert flask.session.modified
242 return "value set"
243
244 @app.route("/get")
245 def get():
246 assert not flask.session.accessed
247 assert not flask.session.modified
248 v = flask.session.get("value", "None")
249 assert flask.session.accessed
250 assert not flask.session.modified
251 return v
252
253 assert client.post("/set", data={"value": "42"}).data == b"value set"
254 assert client.get("/get").data == b"42"
255
256
257def test_session_path(app, client):

Callers

nothing calls this directly

Calls 2

postMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected