def test_ssl_key_barbican_exception(self, barbican_class, cert_data): mock_ssl_key = cert_tasks.SSLKeyCreate() mock_ssl_key.axapi_client = self.client_mock barbican_class.side_effect = Exception self.assertRaises( Exception, lambda: mock_ssl_key.execute(LB, self.listener, VTHUNDER)) self.client_mock.file.ssl_key.exists.assert_not_called()
def test_ssl_key_create_new(self, barbican_class): mock_ssl_key = cert_tasks.SSLKeyCreate() mock_ssl_key.axapi_client = self.client_mock self.client_mock.file.ssl_key.exists.return_value = False mock_ssl_key.execute(CERT_DATA, VTHUNDER) self.client_mock.file.ssl_key.create.assert_called_with( file=a10_test_constants.MOCK_KEY_FILENAME, cert=a10_test_constants.MOCK_KEY_CONTENT, size=len(a10_test_constants.MOCK_KEY_CONTENT), action=a10_test_constants.MOCK_CERT_ACTION) self.client_mock.file.ssl_key.update.assert_not_called()
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
def test_ssl_key_create_revert(self, barbican_class): mock_ssl_key = cert_tasks.SSLKeyCreate() mock_ssl_key.axapi_client = self.client_mock mock_ssl_key.revert(CERT_DATA, VTHUNDER) self.client_mock.file.ssl_key.delete.assert_called_with( file=a10_test_constants.MOCK_KEY_FILENAME)