def test_remove_floatingips_missing_floatingips(self, mock_logger_debug): with mock.patch( 'functest.utils.openstack_clean.os_utils' '.get_floating_ips', return_value=[]): openstack_clean.remove_floatingips(self.client, self.update_list) mock_logger_debug.assert_any_call("Removing floating IPs...") mock_logger_debug.assert_any_call("No floating IPs found.")
def test_remove_floatingips(self, mock_logger_debug): with mock.patch( 'functest.utils.openstack_clean.os_utils' '.get_floating_ips', return_value=self.floatingips_list): openstack_clean.remove_floatingips(self.client, self.update_list) mock_logger_debug.assert_any_call("Removing floating IPs...") mock_logger_debug.assert_any_call(" > this is a default " "floating IP and will " "NOT be deleted.")
def test_remove_floatingips_delete_success(self, mock_logger_debug): with mock.patch('functest.utils.openstack_clean.os_utils' '.get_floating_ips', return_value=self.test_list), \ mock.patch('functest.utils.openstack_clean.os_utils' '.delete_volume', return_value=True): openstack_clean.remove_floatingips(self.client, self.remove_list) mock_logger_debug.assert_any_call("Removing floating IPs...") mock_logger_debug.assert_any_call(" > Done!") mock_logger_debug.assert_any_call( test_utils.RegexMatch("Removing floating " "IP \s*\S+ ..."))
def test_remove_floatingips_delete_failed(self, mock_logger_debug, mock_logger_error): with mock.patch('functest.utils.openstack_clean.os_utils' '.get_floating_ips', return_value=self.test_list), \ mock.patch('functest.utils.openstack_clean.os_utils' '.delete_floating_ip', return_value=False): openstack_clean.remove_floatingips(self.client, self.remove_list) mock_logger_debug.assert_any_call("Removing floating IPs...") mock_logger_error.assert_any_call( test_utils.RegexMatch("There has been a " "problem removing " "the floating IP " "\s*\S+...")) mock_logger_debug.assert_any_call( test_utils.RegexMatch("Removing floating " "IP \s*\S+ ..."))