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

Function test_session_transactions

tests/test_testing.py:158–172  ·  view source on GitHub ↗
(app, client)

Source from the content-addressed store, hash-verified

156
157
158def test_session_transactions(app, client):
159 @app.route("/")
160 def index():
161 return str(flask.session["foo"])
162
163 with client:
164 with client.session_transaction() as sess:
165 assert len(sess) == 0
166 sess["foo"] = [42]
167 assert len(sess) == 1
168 rv = client.get("/")
169 assert rv.data == b"[42]"
170 with client.session_transaction() as sess:
171 assert len(sess) == 1
172 assert sess["foo"] == [42]
173
174
175def test_session_transactions_no_null_sessions():

Callers

nothing calls this directly

Calls 2

session_transactionMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…