Exemplo n.º 1
0
    def testEnumSetters(self):
        config = TSSLConfig()
        bogus_values = ['', 'bogus', 5, 0]
        for v in bogus_values:
            with self.assertRaises(ValueError):
                config.verify = v

        for v in bogus_values:
            with self.assertRaises(ValueError):
                config.ssl_policy = v
Exemplo n.º 2
0
 def configureSSL(self):
     config = TSSLConfig()
     self.assertEquals(config.key_path, "")
     config.ssl_policy = SSLPolicy.REQUIRED
     config.cert_path = 'thrift/test/py/test_cert.pem'
     config.client_verify = SSLVerifyPeerEnum.VERIFY
     config.key_path = None
     # expect an error with a cert_path but no key_path
     with self.assertRaises(ValueError):
         self.server.setSSLConfig(config)
     config.key_path = 'thrift/test/py/test_cert.pem'
     self.server.setSSLConfig(config)