def test_delete_neutron_net_exception(self, mock_logger): self.mock_shade_client.delete_network.side_effect = ( exc.OpenStackCloudException('error message')) output = openstack_utils.delete_neutron_net(self.mock_shade_client, 'network_id') self.assertFalse(output) mock_logger.error.assert_called_once()
def run(self, result): """execute the test""" if not self.setup_done: self.setup() status = op_utils.delete_neutron_net(self.neutron_client, network_id=self.network_id) if status: result.update({"delete_network": 1}) LOG.info("Delete network successful!") else: result.update({"delete_network": 0}) LOG.error("Delete network failed!")
def run(self, result): """execute the test""" if not self.setup_done: self.setup() status = openstack_utils.delete_neutron_net(self.shade_client, self.network_name_or_id) if not status: result.update({"delete_network": 0}) LOG.error("Delete network failed!") raise exceptions.ScenarioDeleteNetworkError result.update({"delete_network": 1}) LOG.info("Delete network successful!")
def run(self, result): """execute the test""" if not self.setup_done: self.setup() status = op_utils.delete_neutron_net(self.neutron_client, network_id=self.network_id) if status: result.update({"del_network": 1}) del_status = 1 LOG.info("Delete network successful!") else: result.update({"del_network": 0}) del_status = 0 LOG.error("Delete network failed!") try: keys = self.scenario_cfg.get('output', '').split() except KeyError: pass else: values = [del_status] return self._push_to_outputs(keys, values)
def test_delete_neutron_net_fail(self): self.mock_shade_client.delete_network.return_value = False output = openstack_utils.delete_neutron_net(self.mock_shade_client, 'network_id') self.assertFalse(output)
def test_delete_neutron_net(self): self.mock_shade_client.delete_network.return_value = True output = openstack_utils.delete_neutron_net(self.mock_shade_client, 'network_name_or_id') self.assertTrue(output)