def test_volume_type_delete_with_group_in_use(self): volume_type = db.volume_type_create(self.ctxt, {'name': 'fake volume type'}) group = db.group_create(self.ctxt, {}) db.group_volume_type_mapping_create(self.ctxt, group['id'], volume_type['id']) self.assertRaises(exception.VolumeTypeInUse, volume_types.destroy, self.ctxt, volume_type['id']) db.group_destroy(self.ctxt, group['id']) volume_types.destroy(self.ctxt, volume_type['id'])
def destroy(self): with self.obj_as_admin(): db.group_destroy(self._context, self.id)