From 88f13598f32bd2da4099f4bb61a082d63fcf42c7 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Thu, 4 Apr 2013 22:40:27 -0400 Subject: [PATCH] Add a unit test for server expiring cookies from session --- test_requests.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test_requests.py b/test_requests.py index 93b8123..c0cb054 100644 --- a/test_requests.py +++ b/test_requests.py @@ -124,6 +124,19 @@ class RequestsTestCase(unittest.TestCase): 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 = { -- 2.7.4