Skip to content
Myr

Add a unit test for server expiring cookies from session

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

authored by Chase Sterling · committed by Chase Sterling · parent d22ac00 · Browse files · 1 file+13 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+13 added−0 removed

  • other:+13 added−0 removed

1 file+13 added−0 removed

modified:test_requests.py+13 added
122 unmodified lines
123 s.get(httpbin('cookies/set?foo=bar'))124 r = s.get(httpbin('redirect/1')) # redirects to httpbin('get')125 self.assertTrue("Cookie" in r.json()["headers"])126127 def test_cookie_removed_on_expire(self):128 s = requests.session()129 s.get(httpbin('cookies/set?foo=bar'))130 self.assertTrue(s.cookies['foo'] == 'bar')131 s.get(132 httpbin('response-headers'),133 params={134 'Set-Cookie':135 'foo=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT'136 }137 )138 self.assertNotIn('foo', s.cookies)139140 def test_user_agent_transfers(self):141142 heads = {143 'User-agent': 'Mozilla/5.0 (github.com/kennethreitz/requests)'
274 unmodified lines