def test_client_ssl_template_barbican_exception(self, barbican_class, cert_data): mock_client_ssl_template = cert_tasks.ClientSSLTemplateCreate() mock_client_ssl_template.axapi_client = self.client_mock barbican_class.side_effect = Exception self.assertRaises( Exception, lambda: mock_client_ssl_template.execute( LB, self.listener, VTHUNDER)) self.client_mock.slb.template.client_ssl.exists.assert_not_called()
def test_client_ssl_template_create_new(self, barbican_class): mock_client_ssl_template = cert_tasks.ClientSSLTemplateCreate() mock_client_ssl_template.axapi_client = self.client_mock self.client_mock.slb.template.client_ssl.exists.return_value = False mock_client_ssl_template.execute(CERT_DATA, VTHUNDER) self.client_mock.slb.template.client_ssl.create.assert_called_with( name=a10_test_constants.MOCK_TEMPLATE_NAME, cert=a10_test_constants.MOCK_CERT_FILENAME, key=a10_test_constants.MOCK_KEY_FILENAME, passphrase=a10_test_constants.MOCK_KEY_PASS) self.client_mock.slb.template.client_ssl.update.assert_not_called()
def test_client_ssl_template_create_update(self): mock_client_ssl_template = cert_tasks.ClientSSLTemplateCreate() mock_client_ssl_template.axapi_client = self.client_mock mock_client_ssl_template.execute(CERT_DATA, VTHUNDER) self.client_mock.slb.template.client_ssl.exists.assert_called_with( name=a10_test_constants.MOCK_LISTENER_ID) self.client_mock.slb.template.client_ssl.update.assert_called_with( name=a10_test_constants.MOCK_LISTENER_ID, cert=a10_test_constants.MOCK_CERT_FILENAME, key=a10_test_constants.MOCK_KEY_FILENAME, passphrase=a10_test_constants.MOCK_KEY_PASS) self.client_mock.slb.template.client_ssl.create.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_client_ssl_template_create_revert(self, barbican_class): mock_client_ssl_template = cert_tasks.ClientSSLTemplateCreate() mock_client_ssl_template.axapi_client = self.client_mock mock_client_ssl_template.revert(CERT_DATA, VTHUNDER) self.client_mock.slb.template.client_ssl.delete.assert_called_with( name=a10_test_constants.MOCK_TEMPLATE_NAME)
def test_client_ssl_template_create_revert(self): mock_client_ssl_template = cert_tasks.ClientSSLTemplateCreate() mock_client_ssl_template.axapi_client = self.client_mock mock_client_ssl_template.revert(CERT_DATA, VTHUNDER) self.client_mock.slb.template.client_ssl.delete.assert_called_with( name=a10_test_constants.MOCK_LISTENER_ID)