Skip to content
Myr

Add a test case for request cookies persisting to session. refs #1728

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

authored by Chase Sterling · committed by Ian Cordasco · parent 4bceb31 · Browse files · 1 file+7 added−1 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+7 added−1 removed

  • other:+7 added−1 removed

1 file+7 added−1 removed

modified:test_requests.py+7 added-1 removed
163 unmodified lines
164 assert s.cookies['foo'] == '"bar:baz"'165166 def test_cookie_persists_via_api(self):167 s = requests.session()168 r = s.get(httpbin('redirect/1'), cookies={'foo':'bar'})168 r = s.get(httpbin('redirect/1'), cookies={'foo': 'bar'})169 assert 'foo' in r.request.headers['Cookie']170 assert 'foo' in r.history[0].request.headers['Cookie']171172 def test_request_cookie_overrides_session_cookie(self):
3 unmodified lines
176 assert r.json()['cookies']['foo'] == 'baz'177 # Session cookie should not be modified178 assert s.cookies['foo'] == 'bar'179180 def test_request_cookies_not_persisted(self):181 s = requests.session()182 s.get(httpbin('cookies'), cookies={'foo': 'baz'})183 # Sending a request with cookies should not add cookies to the session184 assert not s.cookies185186 def test_generic_cookiejar_works(self):187 cj = cookielib.CookieJar()188 cookiejar_from_dict({'foo': 'bar'}, cj)189 s = requests.session()
778 unmodified lines