Make QuobyteHttpsConnectionWithCaVerification py3 compatible
Class 'QuobyteHttpsConnectionWithCaVerification' inherits 'http_client.HTTPConnection' and the latter does not have param 'strict' in py3 anymore. So, remove it as it is not used anyway. Also, fix some quobyte things mocking to satisfy py2/3 compatibility. Change-Id: I422f816c4fa134e08cce811bd44e7021893516bd Partially-Implements: bp py3-compatibility
This commit is contained in:
parent
8a0342ce3c
commit
687153838b
@ -61,9 +61,9 @@ class HTTPSConnectionWithCaVerification(http_client.HTTPConnection):
|
||||
default_port = http_client.HTTPS_PORT
|
||||
|
||||
def __init__(self, host, port=None, key_file=None, cert_file=None,
|
||||
ca_file=None, strict=None,
|
||||
ca_file=None,
|
||||
timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
|
||||
http_client.HTTPConnection.__init__(self, host, port, strict, timeout)
|
||||
http_client.HTTPConnection.__init__(self, host, port, timeout=timeout)
|
||||
self.key_file = key_file
|
||||
self.cert_file = cert_file
|
||||
self.ca_file = ca_file
|
||||
|
@ -61,7 +61,6 @@ class QuobyteHttpsConnectionWithCaVerificationTestCase(test.TestCase):
|
||||
key_file=key_file,
|
||||
cert_file=cert_file,
|
||||
ca_file=ca_file,
|
||||
strict="anything",
|
||||
port=1234,
|
||||
timeout=999))
|
||||
|
||||
@ -90,7 +89,6 @@ class QuobyteHttpsConnectionWithCaVerificationTestCase(test.TestCase):
|
||||
key_file=key_file,
|
||||
cert_file=cert_file,
|
||||
ca_file=ca_file,
|
||||
strict="anything",
|
||||
port=1234,
|
||||
timeout=999))
|
||||
mycon._tunnel_host = "fake_tunnel_host"
|
||||
@ -180,13 +178,17 @@ class QuobyteJsonRpcTestCase(test.TestCase):
|
||||
self.rpc._connection,
|
||||
'request',
|
||||
mock.Mock(side_effect=ssl.SSLError))
|
||||
self.mock_object(
|
||||
self.rpc._connection,
|
||||
'getresponse',
|
||||
mock.Mock(return_value=FakeResponse(
|
||||
403, '{"error":{"code":28,"message":"text"}}')))
|
||||
self.mock_object(jsonrpc.LOG, 'warning')
|
||||
self.mock_object(http_client, 'HTTPSConnection')
|
||||
|
||||
self.assertRaises(exception.QBException,
|
||||
self.rpc.call,
|
||||
'method', {'param': 'value'})
|
||||
http_client.HTTPSConnection.assert_called_once_with(self.rpc._netloc)
|
||||
|
||||
self.assertTrue(self.rpc._disabled_cert_verification)
|
||||
jsonrpc.LOG.warning.assert_called_once_with(
|
||||
"Could not verify server certificate of "
|
||||
|
Loading…
Reference in New Issue
Block a user