def test_remove_routers_missing_routers(self, mock_logger_debug): with mock.patch( 'functest.utils.openstack_clean.os_utils' '.delete_neutron_router', return_value=True): openstack_clean.remove_routers(self.client, self.test_dict_list, self.remove_list) mock_logger_debug.assert_any_call("Router is not connected" " to anything." "Ready to remove...") mock_logger_debug.assert_any_call(" > Done!") mock_logger_debug.assert_any_call( test_utils.RegexMatch("Removing router " "\s*\S+(\s*\S+) ..."))
def test_remove_routers_failed(self, mock_logger_debug, mock_logger_error): with mock.patch( 'functest.utils.openstack_clean.os_utils' '.delete_neutron_router', return_value=False): openstack_clean.remove_routers(self.client, self.test_dict_list, self.remove_list) mock_logger_debug.assert_any_call("Router is not connected" " to anything." "Ready to remove...") mock_logger_debug.assert_any_call( test_utils.RegexMatch("Removing router " "\s*\S+(\s*\S+) ...")) mock_logger_error.assert_any_call( test_utils.RegexMatch("There has been " "a problem" " removing the " "router \s*\S+(" "\s*\S+)..."))
def test_remove_missing_external_gateway(self, mock_logger_debug, mock_logger_error): with mock.patch('functest.utils.openstack_clean.os_utils' '.delete_neutron_router', return_value=False), \ mock.patch('functest.utils.openstack_clean.os_utils' '.remove_gateway_router', return_value=False): self.test_dict_list[0]['external_gateway_info'] = mock.Mock() openstack_clean.remove_routers(self.client, self.test_dict_list, self.remove_list) mock_logger_debug.assert_any_call("Router has gateway to external" " network.Removing link...") mock_logger_error.assert_any_call("There has been a problem " "removing the gateway...") mock_logger_debug.assert_any_call( test_utils.RegexMatch("Removing router " "\s*\S+(\s*\S+) ...")) mock_logger_error.assert_any_call( test_utils.RegexMatch("There has been " "a problem" " removing the " "router \s*\S+(" "\s*\S+)..."))