Exemplo n.º 1
0
 def test_ssl_cert_create_revert(self):
     mock_ssl_cert = cert_tasks.SSLCertCreate()
     mock_ssl_cert.axapi_client = self.client_mock
     mock_ssl_cert.revert(CERT_DATA, VTHUNDER)
     self.client_mock.file.ssl_cert.delete.assert_called_with(
         private_key=a10_test_constants.MOCK_KEY_FILENAME,
         cert_name=a10_test_constants.MOCK_CERT_FILENAME)
 def test_ssl_cert_barbican_exception(self, barbican_class, cert_data):
     mock_ssl_cert = cert_tasks.SSLCertCreate()
     mock_ssl_cert.axapi_client = self.client_mock
     barbican_class.side_effect = Exception
     self.assertRaises(
         Exception,
         lambda: mock_ssl_cert.execute(LB, self.listener, VTHUNDER))
     self.client_mock.file.ssl_cert.exists.assert_not_called()
 def test_ssl_cert_create_new(self, barbican_class, cert_data):
     mock_ssl_cert = cert_tasks.SSLCertCreate()
     mock_ssl_cert.axapi_client = self.client_mock
     self.client_mock.file.ssl_cert.exists.return_value = False
     mock_ssl_cert.execute(LB, self.listener, VTHUNDER)
     self.client_mock.file.ssl_cert.create.assert_called_with(
         file=a10_test_constants.MOCK_CERT_FILENAME,
         cert=a10_test_constants.MOCK_CERT_CONTENT,
         size=len(a10_test_constants.MOCK_CERT_CONTENT),
         action=a10_test_constants.MOCK_CERT_ACTION,
         certificate_type=a10_test_constants.MOCK_CERT_TYPE)
     self.client_mock.file.ssl_cert.update.assert_not_called()
Exemplo n.º 4
0
 def get_ssl_certificate_create_flow(self):
     create_ssl_cert_flow = linear_flow.Flow(
         a10constants.CREATE_SSL_CERT_FLOW)
     create_ssl_cert_flow.add(cert_tasks.GetSSLCertData(
         requires=[constants.LOADBALANCER, constants.LISTENER],
         provides=a10constants.CERT_DATA))
     create_ssl_cert_flow.add(cert_tasks.SSLCertCreate(
         requires=[a10constants.CERT_DATA, a10constants.VTHUNDER]))
     create_ssl_cert_flow.add(cert_tasks.SSLKeyCreate(
         requires=[a10constants.CERT_DATA, a10constants.VTHUNDER]))
     create_ssl_cert_flow.add(cert_tasks.ClientSSLTemplateCreate(
         requires=[a10constants.CERT_DATA, a10constants.VTHUNDER]))
     return create_ssl_cert_flow
Exemplo n.º 5
0
 def test_ssl_cert_create_update(self):
     mock_ssl_cert = cert_tasks.SSLCertCreate()
     mock_ssl_cert.axapi_client = self.client_mock
     mock_ssl_cert.execute(CERT_DATA, VTHUNDER)
     self.client_mock.file.ssl_cert.exists.assert_called_with(
         file=a10_test_constants.MOCK_CERT_FILENAME)
     self.client_mock.file.ssl_cert.update.assert_called_with(
         file=a10_test_constants.MOCK_CERT_FILENAME,
         cert=a10_test_constants.MOCK_CERT_CONTENT,
         size=len(a10_test_constants.MOCK_CERT_CONTENT),
         action=a10_test_constants.MOCK_CERT_ACTION,
         certificate_type=a10_test_constants.MOCK_CERT_TYPE)
     self.client_mock.file.ssl_cert.create.assert_not_called()
 def test_ssl_cert_create_revert(self, barbican_class, cert_data):
     mock_ssl_cert = cert_tasks.SSLCertCreate()
     mock_ssl_cert.axapi_client = self.client_mock
     mock_ssl_cert.revert(LB, self.listener, VTHUNDER)
     self.client_mock.file.ssl_cert.delete.assert_called_with(
         file=a10_test_constants.MOCK_CERT_FILENAME)
Exemplo n.º 7
0
 def test_GetSSLCertData_barbican_exception(self, barbican_class):
     mock_ssl_cert = cert_tasks.SSLCertCreate()
     mock_ssl_cert.axapi_client = self.client_mock
     barbican_class.side_effect = Exception
     self.assertRaises(Exception, lambda: mock_ssl_cert.execute(LB, LISTENER))
     self.client_mock.file.ssl_cert.exists.assert_not_called()