Skip to content
Myr

Add tests for the `Vary: Cookie` header

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

authored by Mihir Singh · committed by Mihir Singh · parent 671c67a · Browse files · 1 file+50 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+50 added−0 removed

  • other:+50 added−0 removed

1 file+50 added−0 removed

modified:flask/testsuite/basic.py+50 added
394 unmodified lines
395 is_permanent = False396 app.config['SESSION_REFRESH_EACH_REQUEST'] = False397 run_test(expect_header=False)398399 def test_session_vary_cookie(self):400401 app = flask.Flask(__name__)402 app.secret_key = 'testkey'403404 @app.route('/set-session')405 def set_session():406407 flask.session['test'] = 'test'408 return ''409410 @app.route('/get-session')411 def get_session():412413 s = flask.session.get('test')414 return ''415416 @app.route('/get-session-with-dictionary')417 def get_session_with_dictionary():418419 s = flask.session['test']420 return ''421422 @app.route('/no-vary-header')423 def no_vary_header():424425 return ''426427 c = app.test_client()428429 rv = c.get('/set-session')430431 self.assert_in('Vary', rv.headers)432 self.assert_equal('Cookie', rv.headers['Vary'])433434 rv = c.get('/get-session')435436 self.assert_in('Vary', rv.headers)437 self.assert_equal('Cookie', rv.headers['Vary'])438439 rv = c.get('/get-session-with-dictionary')440441 self.assert_in('Vary', rv.headers)442 self.assert_equal('Cookie', rv.headers['Vary'])443444 rv = c.get('/no-vary-header')445446 self.assert_not_in('Vary', rv.headers)447448449 def test_flashes(self):450 app = flask.Flask(__name__)451 app.secret_key = 'testkey'452
953 unmodified lines