Skip to content
Myr

Test for cookie parameters.

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

authored by Ralph Bean · committed by Ralph Bean · parent beec48c · Browse files · 1 file+17 added−0 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+17 added−0 removed

  • other:+17 added−0 removed

1 file+17 added−0 removed

modified:test_requests.py+17 added
264 unmodified lines
265 url = 'https://api.github.com/users/kennethreitz/repos?page=1&per_page=10'266 r = requests.head(url=url)267 self.assertEqual(r.links['next']['rel'], 'next')268269 def test_cookie_parameters(self):270 key = 'some_cookie'271 value = 'some_value'272 secure = True273 domain = 'test.com'274 rest = {'HttpOnly': True}275276 jar = requests.cookies.RequestsCookieJar()277 jar.set(key, value, secure=secure, domain=domain, rest=rest)278279 self.assertEqual(len(jar), 1)280 self.assertIn('some_cookie', jar)281282 cookie = list(jar)[0]283 self.assertEqual(cookie.secure, secure)284 self.assertEqual(cookie.domain, domain)285 self.assertEqual(cookie._rest['HttpOnly'], rest['HttpOnly'])286287if __name__ == '__main__':288 unittest.main()