def image_to_delete(ebnt: Ebonite, model, mock_env): task = ebnt.get_or_create_task('Project', 'Task') ebnt.meta_repo.create_environment(mock_env) image = Image('image', BuildableMock(), id=None, task_id=task.id, params=Image.Params()) image.environment = mock_env image.params.name = 'image' image.bind_builder(mock_env.params.get_builder()) image = ebnt.meta_repo.create_image(image) yield image
def test_delete_task_cascade_ok(ebnt: Ebonite, model: Model, mock_env, image: Image, pipeline: Pipeline): task = ebnt.get_or_create_task('Project', 'Task') model = ebnt.push_model(model, task) image.environment = ebnt.meta_repo.create_environment(mock_env) task.add_pipeline(pipeline) task.add_image(image) task = ebnt.meta_repo.get_task_by_id(task.id).bind_as(task) assert ebnt.meta_repo.get_task_by_id(task.id) is not None assert ebnt.meta_repo.get_model_by_id(model.id) is not None assert ebnt.meta_repo.get_pipeline_by_id(pipeline.id) is not None assert ebnt.meta_repo.get_image_by_id(image.id) is not None ebnt.delete_task(task, cascade=True) assert ebnt.meta_repo.get_task_by_id(task.id) is None assert ebnt.meta_repo.get_model_by_id(model.id) is None assert ebnt.meta_repo.get_pipeline_by_id(pipeline.id) is None assert ebnt.meta_repo.get_image_by_id(image.id) is None