예제 #1
0
 def test_delete_neutron_router_exception(self, mock_logger):
     self.mock_shade_client.delete_router.side_effect = (
         exc.OpenStackCloudException('error message'))
     output = openstack_utils.delete_neutron_router(self.mock_shade_client,
                                                    'router_id')
     mock_logger.error.assert_called_once()
     self.assertFalse(output)
예제 #2
0
    def run(self, result):
        """execute the test"""

        if not self.setup_done:
            self.setup()

        status = op_utils.delete_neutron_router(self.neutron_client,
                                                router_id=self.router_id)
        if status:
            result.update({"delete_router": 1})
            LOG.info("Delete router successful!")
        else:
            result.update({"delete_router": 0})
            LOG.error("Delete router failed!")
예제 #3
0
    def run(self, result):
        """execute the test"""

        if not self.setup_done:
            self.setup()

        status = openstack_utils.delete_neutron_router(self.shade_client,
                                                       self.router_id)
        if not status:
            result.update({"delete_router": 0})
            LOG.error("Delete router failed!")
            raise exceptions.ScenarioDeleteRouterError

        result.update({"delete_router": 1})
        LOG.info("Delete router successful!")
예제 #4
0
 def test_delete_neutron_router_fail(self):
     self.mock_shade_client.delete_router.return_value = False
     output = openstack_utils.delete_neutron_router(self.mock_shade_client,
                                                    'router_id')
     self.assertFalse(output)