Skip to content
Myr

test the cookies!

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

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 358478e · Browse files · 1 file+24 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+24 added−1 removed

  • other:+24 added−1 removed

1 file+24 added−1 removed

modified:test_requests.py+24 added-1 removed
57 unmodified lines
58 """Teardown."""59 # self.httpbin.kill()6061 def test_entry_points(self):62 import requests6263 requests.session64 requests.session().get65 requests.session().head
414 unmodified lines
480 assert new_heads['User-agent'] in r3.content481482 self.assertEqual(r2.status_code, 200)483484 def test_session_persistent_cookies(self):485486 s = requests.session()487488 # Internally dispatched cookies are sent.489 _c = {'kenneth': 'reitz', 'bessie': 'monke'}490 r = s.get(httpbin('cookies'), cookies=_c)491 r = s.get(httpbin('cookies'))492493 # Those cookies persist transparently.494 c = json.loads(r.content).get('cookies')495 assert c == _c496497 # Double check.498 r = s.get(httpbin('cookies'), cookies={})499 c = json.loads(r.content).get('cookies')500 assert c == _c501502 # Remove a cookie by setting it's value to None.503 r = s.get(httpbin('cookies'), cookies={'bessie': None})504 c = json.loads(r.content).get('cookies')505 del _c['bessie']506 assert c == _c507508509 def test_session_persistent_params(self):510511 params = {'a': 'a_test'}512
35 unmodified lines