def test_destroy_with_not_equal_constraint_met(self): ctx = context.get_admin_context() instance = db.instance_create(ctx, {'task_state': 'deleting'}) constraint = db.constraint(task_state=db.not_equal('error', 'resize')) db.instance_destroy(ctx, instance['uuid'], constraint) self.assertRaises(exception.InstanceNotFound, db.instance_get_by_uuid, ctx, instance['uuid'])
def test_destroy_with_not_equal_constraint_not_met(self): ctx = context.get_admin_context() instance = db.instance_create(ctx, {"vm_state": "active"}) constraint = db.constraint(vm_state=db.not_equal("active", "error")) self.assertRaises(exception.ConstraintNotMet, db.instance_destroy, ctx, instance["uuid"], constraint) instance = db.instance_get_by_uuid(ctx, instance["uuid"]) self.assertFalse(instance["deleted"])
def test_destroy_with_not_equal_constraint_not_met(self): ctx = context.get_admin_context() instance = db.instance_create(ctx, {'vm_state': 'active'}) constraint = db.constraint(vm_state=db.not_equal('active', 'error')) self.assertRaises(exception.ConstraintNotMet, db.instance_destroy, ctx, instance['uuid'], constraint) instance = db.instance_get_by_uuid(ctx, instance['uuid']) self.assertFalse(instance['deleted'])
def test_destroy_with_not_equal_constraint_met(self): ctx = context.get_admin_context() instance = db.instance_create(ctx, {"task_state": "deleting"}) constraint = db.constraint(task_state=db.not_equal("error", "resize")) db.instance_destroy(ctx, instance["uuid"], constraint) self.assertRaises(exception.InstanceNotFound, db.instance_get_by_uuid, ctx, instance["uuid"])