From: Chase Sterling Date: Thu, 7 Nov 2013 00:39:56 +0000 (-0500) Subject: Add a test case for request cookies persisting to session. refs #1728 X-Git-Tag: v2.1.0~1^2~2^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b30e960eb6ebb62f22c52653f4b134e917594a2;p=services%2Fpython-requests.git Add a test case for request cookies persisting to session. refs #1728 --- diff --git a/test_requests.py b/test_requests.py index 1d68c81..617e6a7 100755 --- a/test_requests.py +++ b/test_requests.py @@ -165,7 +165,7 @@ class RequestsTestCase(unittest.TestCase): def test_cookie_persists_via_api(self): s = requests.session() - r = s.get(httpbin('redirect/1'), cookies={'foo':'bar'}) + r = s.get(httpbin('redirect/1'), cookies={'foo': 'bar'}) assert 'foo' in r.request.headers['Cookie'] assert 'foo' in r.history[0].request.headers['Cookie'] @@ -177,6 +177,12 @@ class RequestsTestCase(unittest.TestCase): # Session cookie should not be modified assert s.cookies['foo'] == 'bar' + def test_request_cookies_not_persisted(self): + s = requests.session() + s.get(httpbin('cookies'), cookies={'foo': 'baz'}) + # Sending a request with cookies should not add cookies to the session + assert not s.cookies + def test_generic_cookiejar_works(self): cj = cookielib.CookieJar() cookiejar_from_dict({'foo': 'bar'}, cj)