Add tests for settings
authorJohannes Gorset <jgorset@gmail.com>
Thu, 19 May 2011 08:13:42 +0000 (10:13 +0200)
committerJohannes Gorset <jgorset@gmail.com>
Thu, 19 May 2011 08:13:42 +0000 (10:13 +0200)
test_requests.py

index 416867229241706c5e0bfce4b8044350688418a0..436b8bc9a6427954f2ce22845b1e043bdae8a5ea 100755 (executable)
@@ -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__':