Added failing test for issue #380.
authorCory Benfield <lukasaoz@gmail.com>
Thu, 16 Feb 2012 18:21:32 +0000 (18:21 +0000)
committerCory Benfield <lukasaoz@gmail.com>
Thu, 16 Feb 2012 18:21:32 +0000 (18:21 +0000)
tests/test_requests.py

index 76df752..14e7657 100755 (executable)
@@ -23,8 +23,7 @@ from requests.auth import HTTPBasicAuth, HTTPDigestAuth
 
 
 
-if (sys.platform == 'win32') and ('HTTPBIN_URL' not in os.environ):
-    os.environ['HTTPBIN_URL'] = 'http://httpbin.org/'
+os.environ['HTTPBIN_URL'] = 'http://httpbin.org/'
 
 # TODO: Detect an open port.
 PORT = os.environ.get('HTTPBIN_PORT', '7077')
@@ -813,6 +812,18 @@ class RequestsTestSuite(TestSetup, unittest.TestCase):
 
         r = requests.get(httpbin('post'), auth=('a', 'b'), data='\xff')
 
+    def test_useful_exception_for_invalid_schema(self):
+        
+        try:
+          self.assertRaises(
+              requests.exceptions.URLRequired,
+              get,
+              'http://http://')
+        # To make this test as minimal as possible, only catch the
+        # exception raised in issue #380.
+        except ValueError:
+          self.fail()
+
 
 
 if __name__ == '__main__':