'Do not stop deleting stacks even failed deleting user_creds.
It may happen that user_creds were incorrectly saved (truncated) and
thus cannot be correctly retrieved (and decrypted). In this case,
stack delete should not be stopped.'

def test_delete_user_creds_fail(self):

    self.stack = stack.Stack(self.ctx, 'delete_test', self.tmpl)
    stack_id = self.stack.store()
    db_s = stack_object.Stack.get_by_id(self.ctx, stack_id)
    self.assertIsNotNone(db_s)
    self.assertIsNotNone(db_s.user_creds_id)
    exc = exception.Error('Cannot    get    user    credentials')
    self.patchobject(ucreds_object.UserCreds, 'get_by_id').side_effect = exc
    self.stack.delete()
    db_s = stack_object.Stack.get_by_id(self.ctx, stack_id)
    self.assertIsNone(db_s)
    self.assertEqual((stack.Stack.DELETE, stack.Stack.COMPLETE), self.stack.state)
