

def test_connection_failed(self):
    self.mox.StubOutWithMock(self.client.httpclient, 'request')
    self.client.httpclient.auth_token = 'token'
    self.client.httpclient.request(end_url('/test'), 'GET', headers=mox.ContainsKeyValue('X-Auth-Token', 'token')).AndRaise(requests.exceptions.ConnectionError('Connection refused'))
    self.mox.ReplayAll()
    error = self.assertRaises(exceptions.ConnectionFailed, self.client.get, '/test')
    self.assertIsNotNone(error.status_code)
    self.mox.VerifyAll()
    self.mox.UnsetStubs()

dataset/ETHPy150Open openstack/python-group-based-policy-client/gbpclient/tests/unit/test_cli20.py CLITestV20ExceptionHandler.test_connection_failed/original