From 2c76122a48c6a4b513930fed56c0aea5362d6c9c Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Fri, 29 Aug 2014 14:07:28 -0700 Subject: [PATCH] Add test that invalid domain raises a ConnectionError --- test_requests.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test_requests.py b/test_requests.py index 716c0dcf..3868f9dc 100755 --- a/test_requests.py +++ b/test_requests.py @@ -286,6 +286,11 @@ class RequestsTestCase(unittest.TestCase): r = s.get(url) assert r.status_code == 200 + def test_connection_error(self): + """Connecting to an unknown domain should raise a ConnectionError""" + with pytest.raises(ConnectionError): + requests.get("http://fooobarbangbazbing.httpbin.org") + def test_basicauth_with_netrc(self): auth = ('user', 'pass') wrong_auth = ('wronguser', 'wrongpass')