def delete_func(self, asset): try: asset = assets_service.get_asset_by_shotgun_id(asset.shotgun_id) tasks = tasks_service.get_tasks_for_asset(asset["id"]) if self.is_working_files_linked(tasks): assets_service.cancel_asset(asset["id"]) else: for task in tasks: deletion_service.remove_task(task["id"]) assets_service.remove_asset(asset["id"]) return asset except AssetNotFoundException: return None
def test_cancel_asset(self): asset_id = self.entity.id assets_service.cancel_asset(asset_id) asset = assets_service.get_asset(asset_id) self.assertTrue(asset["canceled"])