def test_client_no_client_cert(self): client = CustodiaSimpleClient(self.socket_url + '/forwarder') client.headers['REMOTE_USER'] = '******' client.set_ca_cert(self.ca_cert) with self.assertRaises(SSLError) as e: client.list_container('test') self.assert_ssl_error_msg("SSLV3_ALERT_HANDSHAKE_FAILURE", e.exception)
def test_client_no_client_cert(self): client = CustodiaSimpleClient(self.socket_url + '/forwarder') client.headers['REMOTE_USER'] = '******' client.set_ca_cert(self.ca_cert) with self.assertRaises(SSLError) as e: client.list_container('test') self.assertIn("SSLV3_ALERT_HANDSHAKE_FAILURE", str(e.exception))
def test_client_no_client_cert(self): client = CustodiaSimpleClient(self.socket_url + '/forwarder') client.headers['REMOTE_USER'] = '******' client.set_ca_cert(self.ca_cert) # XXX workaround for requests bug with urllib3 v1.22 with self.assertRaises(RequestsConnSSLErrors) as e: client.list_container('test') self.assert_ssl_error_msg("SSLV3_ALERT_HANDSHAKE_FAILURE", e.exception)
def custodia_client(self): if self._custodia_client is None: sec = self.custodia_client_section url = self.get(sec, 'url') client = CustodiaSimpleClient(url) headers = self.get(sec, 'headers', fallback=None) if headers: headers = json.loads(headers) client.headers.update(headers) tls_cafile = self.get(sec, 'tls_cafile', fallback=None) if tls_cafile: client.set_ca_cert(tls_cafile) certfile = self.get(sec, 'tls_certfile', fallback=None) keyfile = self.get(sec, 'tls_keyfile', fallback=None) if certfile: client.set_client_cert(certfile, keyfile) self._custodia_client = client return self._custodia_client