From 21e2d0c34a7f3e7b661ca93cb6afd3c0fcffa3c9 Mon Sep 17 00:00:00 2001 From: Johannes Gorset Date: Thu, 19 May 2011 10:13:42 +0200 Subject: [PATCH] Add tests for settings --- test_requests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test_requests.py b/test_requests.py index 41686722..436b8bc9 100755 --- a/test_requests.py +++ b/test_requests.py @@ -155,6 +155,16 @@ class RequestsTestSuite(unittest.TestCase): r = requests.get('https://convore.com/api/account/verify.json', auth=conv_auth) self.assertEquals(r.status_code, 401) + + def test_settings(self): + import urllib2 + + with requests.settings(timeout=0): + self.assertRaises(urllib2.URLError, requests.get, 'http://google.com') + + with requests.settings(timeout=10): + requests.get('http://google.com') + if __name__ == '__main__':