From 54fd24b7575af3c9fb8218aeae4d06c9d0ea3317 Mon Sep 17 00:00:00 2001 From: Zbigniew Siciarz Date: Thu, 9 Jun 2011 12:30:43 +0200 Subject: [PATCH] Testing that cookies actually work. --- test_requests.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test_requests.py b/test_requests.py index b2e570d..73c822a 100755 --- a/test_requests.py +++ b/test_requests.py @@ -152,15 +152,17 @@ class RequestsTestSuite(unittest.TestCase): def test_cookie_jar(self): - """ - .. todo:: This really doesn't test to make sure the cookie is working - """ - jar = cookielib.CookieJar() self.assertFalse(jar) - - requests.get('http://google.com', cookies=jar) + data = {'cn': 'requests_cookie', 'cv': 'awesome'} + r = requests.post('http://www.html-kit.com/tools/cookietester/', data=data, cookies=jar, allow_redirects=True) self.assertTrue(jar) + cookie_found = False + for cookie in jar: + if cookie.name == 'requests_cookie': + self.assertEquals(cookie.value, 'awesome') + cookie_found = True + self.assertTrue(cookie_found) def test_decompress_gzip(self): -- 2.34.1