From 69ba64380b5eee14f741f45b22711115fe5c6d98 Mon Sep 17 00:00:00 2001 From: Michael Komitee Date: Wed, 13 Feb 2013 21:28:32 -0500 Subject: [PATCH] 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. --- test_requests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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') -- 2.34.1