Skip to content
Myr

Fixed session loading in flask.testing.TestClient.session_transaction()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michał Bartoszkiewicz · committed by Michał Bartoszkiewicz · parent 87f50fd · Browse files · 2 files+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+4 added−1 removed

  • other:+4 added−1 removed

2 files+4 added−1 removed

modified:flask/testsuite/testing.py+3 added
57 unmodified lines
58 sess['foo'] = [42]59 self.assert_equal(len(sess), 1)60 rv = c.get('/')61 self.assert_equal(rv.data, '[42]')62 with c.session_transaction() as sess:63 self.assert_equal(len(sess), 1)64 self.assert_equal(sess['foo'], [42])6566 def test_session_transactions_no_null_sessions(self):67 app = flask.Flask(__name__)68 app.testing = True
100 unmodified lines
modified:flask/testing.py+1 added-1 removed
55 unmodified lines
56 if self.cookie_jar is None:57 raise RuntimeError('Session transactions only make sense '58 'with cookies enabled.')59 app = self.application60 environ_overrides = kwargs.pop('environ_overrides', {})60 environ_overrides = kwargs.setdefault('environ_overrides', {})61 self.cookie_jar.inject_wsgi(environ_overrides)62 outer_reqctx = _request_ctx_stack.top63 with app.test_request_context(*args, **kwargs) as c:64 sess = app.open_session(c.request)
59 unmodified lines