Skip to content

Commit

Permalink
Add a unit test for server expiring cookies from session
Browse files Browse the repository at this point in the history
  • Loading branch information
gazpachoking committed Apr 5, 2013
1 parent d22ac00 commit 88f1359
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ def test_cookie_sent_on_redirect(self):
r = s.get(httpbin('redirect/1')) # redirects to httpbin('get')
self.assertTrue("Cookie" in r.json()["headers"])

def test_cookie_removed_on_expire(self):
s = requests.session()
s.get(httpbin('cookies/set?foo=bar'))
self.assertTrue(s.cookies['foo'] == 'bar')
s.get(
httpbin('response-headers'),
params={
'Set-Cookie':
'foo=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT'
}
)
self.assertNotIn('foo', s.cookies)

def test_user_agent_transfers(self):

heads = {
Expand Down

0 comments on commit 88f1359

Please sign in to comment.