def setUp(self): super(TestHTTPClient, self).setUp() self.mox = mox.Mox() self.mox.StubOutWithMock(HTTPClient, 'request') self.addCleanup(self.mox.UnsetStubs) self.http = HTTPClient(token=AUTH_TOKEN, endpoint_url=END_URL)
def test_proper_exception_is_raised_when_cert_validation_fails(self): http = HTTPClient(token=AUTH_TOKEN, endpoint_url=END_URL) self.mox.StubOutWithMock(HTTPClient, 'request') HTTPClient.request(URL, METHOD, headers=mox.IgnoreArg()).AndRaise( requests.exceptions.SSLError) self.mox.ReplayAll() self.assertRaises(exceptions.SslCertificateValidationError, http._cs_request, URL, METHOD) self.mox.VerifyAll()
def setUp(self): super(TestHTTPClient, self).setUp() self.addCleanup(mock.patch.stopall) self.http = HTTPClient(token=AUTH_TOKEN, endpoint_url=END_URL)