def testFail(self): if hasattr(ssl, 'PROTOCOL_TLS'): del ssl.PROTOCOL_TLS if hasattr(ssl, 'PROTOCOL_TLSv1_2'): del ssl.PROTOCOL_TLSv1_2 with self.assertRaises(serverless_exceptions.NoTLSError): connection_context._CheckTLSSupport()
def testFailBadSSL(self): self.StartObjectPatch(ssl, 'OPENSSL_VERSION', new='OpenSSL 0.9.8zh') # Make sure we ask for SSL >1.0 with self.assertRaisesRegex(serverless_exceptions.NoTLSError, '>1\\.0'): connection_context._CheckTLSSupport()
def testSucceed(self): ssl.PROTOCOL_TLS = 2 connection_context._CheckTLSSupport()