Add another session cookie test
authorChase Sterling <chase.sterling@gmail.com>
Fri, 26 Apr 2013 03:11:43 +0000 (23:11 -0400)
committerChase Sterling <chase.sterling@gmail.com>
Fri, 26 Apr 2013 03:11:43 +0000 (23:11 -0400)
test_requests.py

index c0ed58d..9339476 100644 (file)
@@ -138,6 +138,14 @@ class RequestsTestCase(unittest.TestCase):
         )
         assert 'foo' not in s.cookies
 
+    def test_request_cookie_overrides_session_cookie(self):
+        s = requests.session()
+        s.cookies['foo'] = 'bar'
+        r = s.get(httpbin('cookies'), cookies={'foo': 'baz'})
+        assert r.json()['cookies']['foo'] == 'baz'
+        # Session cookie should not be modified
+        assert s.cookies['foo'] == 'bar'
+
     def test_generic_cookiejar_works(self):
         cj = cookielib.CookieJar()
         cookiejar_from_dict({'foo': 'bar'}, cj)