From: Michael Komitee Date: Thu, 14 Feb 2013 02:28:32 +0000 (-0500) Subject: Adding test to ensure options like stream function with authentication X-Git-Tag: v1.2.0~28^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=69ba64380b5eee14f741f45b22711115fe5c6d98;p=services%2Fpython-requests.git Adding test to ensure options like stream function with authentication This test demonstrates the reason why we need to pass kwargs to hooks. Without it, features like stream cannot work with authentication. --- diff --git a/test_requests.py b/test_requests.py index e12722d..f6f5531 100644 --- a/test_requests.py +++ b/test_requests.py @@ -172,6 +172,18 @@ class RequestsTestCase(unittest.TestCase): r = s.get(url) self.assertEqual(r.status_code, 200) + def test_DIGEST_STREAM(self): + + auth = HTTPDigestAuth('user', 'pass') + url = httpbin('digest-auth', 'auth', 'user', 'pass') + + r = requests.get(url, auth=auth, stream=True) + self.assertNotEqual(r.raw.read(), '') + + r = requests.get(url, auth=auth, stream=False) + self.assertEqual(r.raw.read(), '') + + def test_DIGESTAUTH_WRONG_HTTP_401_GET(self): auth = HTTPDigestAuth('user', 'wrongpass')