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.
This commit is contained in:
Michael Komitee
2013-02-13 21:28:32 -05:00
parent d0285fac42
commit 69ba64380b
+12
View File
@@ -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')