def test_remove_instances_missing_instances(self, mock_logger_debug):
     with mock.patch(
             'functest.utils.openstack_clean.os_utils'
             '.get_instances',
             return_value=[]):
         openstack_clean.remove_instances(self.client, self.update_list)
         mock_logger_debug.assert_any_call("Removing Nova instances...")
         mock_logger_debug.assert_any_call("No instances found.")
 def test_remove_instances(self, mock_logger_debug):
     with mock.patch(
             'functest.utils.openstack_clean.os_utils'
             '.get_instances',
             return_value=self.test_list):
         openstack_clean.remove_instances(self.client, self.update_list)
         mock_logger_debug.assert_any_call("Removing Nova instances...")
         mock_logger_debug.assert_any_call("   > this is a default "
                                           "instance and will "
                                           "NOT be deleted.")
 def test_remove_instances_pending_delete_success(self, mock_logger_debug):
     with mock.patch('functest.utils.openstack_clean.os_utils'
                     '.get_instances', return_value=self.deleted_list), \
             mock.patch('functest.utils.openstack_clean.os_utils'
                        '.delete_instance', return_value=True):
         openstack_clean.remove_instances(self.client, self.remove_list)
         mock_logger_debug.assert_any_call("Removing Nova instances...")
         mock_logger_debug.test_utils.RegexMatch(
             "Removing"
             " instance"
             " '\s*\S+'"
             " ...").assert_not_called()
 def test_remove_instances_delete_failed(self, mock_logger_debug,
                                         mock_logger_error):
     with mock.patch('functest.utils.openstack_clean.os_utils'
                     '.get_instances', return_value=self.test_list), \
             mock.patch('functest.utils.openstack_clean.os_utils'
                        '.delete_instance', return_value=False):
         openstack_clean.remove_instances(self.client, self.remove_list)
         mock_logger_debug.assert_any_call("Removing Nova instances...")
         mock_logger_error.assert_any_call(
             test_utils.RegexMatch("There has been a "
                                   "problem removing "
                                   "the instance \s*\S+"
                                   "..."))
         mock_logger_debug.assert_any_call(
             test_utils.RegexMatch("Removing"
                                   " instance"
                                   " '\s*\S+'"
                                   " ..."))