Skip to content
Myr

Added testcase for redirect and session keeparound bug

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

authored by Priit Laes · committed by Priit Laes · parent 7f4c12b · Browse files · 1 file+26 added−0 removed
This commit

State

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

Diff stats

1 file+26 added−0 removed

  • other:+26 added−0 removed

1 file+26 added−0 removed

modified:flask/testsuite/testing.py+26 added
44 unmodified lines
45 with app.test_client() as c:46 rv = c.get('/')47 self.assert_equal(rv.data, 'http://localhost/')4849 def test_redirect_keep_session(self):50 app = flask.Flask(__name__)51 app.secret_key = 'testing'5253 @app.route('/', methods=['GET', 'POST'])54 def index():55 if flask.request.method == 'POST':56 return flask.redirect('/redirect')57 flask.session['data'] = 'foo'58 return 'index'5960 @app.route('/redirect')61 def redirect():62 return 'redirect'6364 with app.test_client() as c:65 ctx = app.test_request_context()66 ctx.push()67 rv = c.get('/')68 assert rv.data == 'index'69 assert flask.session.get('data') == 'foo'70 rv = c.post('/', data={}, follow_redirects=True)71 assert rv.data == 'redirect'72 assert flask.session.get('data') == 'foo'73 ctx.pop()7475 def test_session_transactions(self):76 app = flask.Flask(__name__)77 app.testing = True78 app.secret_key = 'testing'
119 unmodified lines