split test_connection_error into two distinct tests, and changed "unknown url" test...
authorColin Dickson <colin.dickson@gmail.com>
Wed, 4 Feb 2015 02:23:07 +0000 (21:23 -0500)
committerColin Dickson <colin.dickson@gmail.com>
Wed, 4 Feb 2015 02:23:07 +0000 (21:23 -0500)
test_requests.py

index 224b0dfe584b57f30ff664cb7b810f32acb36d2f..3f496fc872f93c6b2c18418e7e05bfa03464fbc3 100755 (executable)
@@ -301,11 +301,13 @@ class RequestsTestCase(unittest.TestCase):
         r = s.get(url)
         assert r.status_code == 200
 
-    def test_connection_error(self):
+    def test_connection_error_invalid_domain(self):
         """Connecting to an unknown domain should raise a ConnectionError"""
         with pytest.raises(ConnectionError):
-            requests.get("http://fooobarbangbazbing.httpbin.org")
+            requests.get("http://doesnotexist.google.com")
 
+    def test_connection_error_invalid_port(self):
+        """Connecting to an invalid port should raise a ConnectionError"""
         with pytest.raises(ConnectionError):
             requests.get("http://httpbin.org:1")