def workflow_pipeline_delete( organization_uuid, organization_workflow_uuid, organization_workflow_pipeline_uuid ): """Delete an Organization Workflow Pipeline. --- tags: - workflows parameters: - in: header name: Workflow-API-Key description: Requires key type REACT_CLIENT schema: type: string responses: "200": description: "Delete an Organization Workflow Pipeline" "400": description: "Bad request" "503": description: "Http error" """ try: delete_workflow_pipeline( organization_uuid, organization_workflow_uuid, organization_workflow_pipeline_uuid, ) return {}, 200 except HTTPError as http_error: return {"message": http_error.args[0]}, 503 except ValueError as value_error: return jsonify(value_error.args[0]), 400
def test_find_dest_workflow_runs(delay_mock, app, workflow_line): workflow_run = create_workflow_run( workflow_line.uuid, { "callback_url": "http://example.com/cb", "inputs": [], }, ) assert queries.find_dest_workflow_runs( workflow_run.workflow_pipeline_runs[0]) == [ workflow_run.workflow_pipeline_runs[1].pipeline_run ] assert queries.find_dest_workflow_runs( workflow_run.workflow_pipeline_runs[1]) == [ workflow_run.workflow_pipeline_runs[2].pipeline_run ] assert queries.find_dest_workflow_runs( workflow_run.workflow_pipeline_runs[2]) == [] # if a workflow_pipeline is deleted it is not found/included delete_workflow_pipeline( workflow_run.workflow.uuid, workflow_run.workflow_pipeline_runs[1].workflow_pipeline.uuid, ) assert queries.find_dest_workflow_runs( workflow_run.workflow_pipeline_runs[0]) == []
def test_delete_workflow_pipeline_invalid_org_workflow( app, organization_workflow, organization_pipeline, organization_workflow_pipeline): with pytest.raises(ValueError): delete_workflow_pipeline( organization_workflow.organization_uuid, "1234", organization_workflow_pipeline.uuid, )
def test_delete_workflow_pipeline_with_associations(app, workflow, workflow_pipeline): pipeline_with_dest = services.create_workflow_pipeline( workflow_pipeline.workflow.uuid, _create_workflow_pipeline_json(workflow_pipeline.pipeline, [], [workflow_pipeline.uuid]), ) the_uuid = pipeline_with_dest.uuid services.delete_workflow_pipeline(workflow.uuid, pipeline_with_dest.uuid) assert pipeline_with_dest.is_deleted assert find_workflow_pipeline(the_uuid) is None assert workflow_pipeline.source_workflow_pipelines == []
def test_create_workflow_run_deleted_workflow_pipeline(execute_pipeline_mock, app, pipeline, workflow_pipeline): services.delete_workflow_pipeline(workflow_pipeline.workflow.uuid, workflow_pipeline.uuid) create_data = { "callback_url": "https://example.com", "inputs": [], } workflow = workflow_pipeline.workflow with pytest.raises(ValueError): services.create_workflow_run(workflow.uuid, create_data) assert len(workflow.workflow_runs) == 0
def test_delete_workflow_pipeline_not_found(app, organization_workflow, organization_workflow_pipeline): wf_uuid = organization_workflow.workflow_uuid wf_pipeline_uuid = organization_workflow_pipeline.workflow_pipeline_uuid responses.add( responses.DELETE, f"{app.config[WORKFLOW_HOSTNAME]}/v1/workflows/{wf_uuid}/pipelines/{wf_pipeline_uuid}", json={"not": "found"}, status=404, ) with pytest.raises(HTTPError): delete_workflow_pipeline( organization_workflow.organization_uuid, organization_workflow.uuid, organization_workflow_pipeline.uuid, )
def test_delete_workflow_pipeline_bad_json(app, organization_workflow, organization_workflow_pipeline): wf_uuid = organization_workflow.workflow_uuid wf_pipeline_uuid = organization_workflow_pipeline.workflow_pipeline_uuid responses.add( responses.DELETE, f"{app.config[WORKFLOW_HOSTNAME]}/v1/workflows/{wf_uuid}/pipelines/{wf_pipeline_uuid}", body="notjson", status=503, ) with pytest.raises(HTTPError): delete_workflow_pipeline( organization_workflow.organization_uuid, organization_workflow.uuid, organization_workflow_pipeline.uuid, )
def test_delete_workflow_pipeline(app, organization_workflow, organization_workflow_pipeline): wf_uuid = organization_workflow.workflow_uuid wf_pipeline_uuid = organization_workflow_pipeline.workflow_pipeline_uuid responses.add( responses.DELETE, f"{app.config[WORKFLOW_HOSTNAME]}/v1/workflows/{wf_uuid}/pipelines/{wf_pipeline_uuid}", status=204, ) delete_workflow_pipeline( organization_workflow.organization_uuid, organization_workflow.uuid, organization_workflow_pipeline.uuid, ) ow_pipeline = OrganizationWorkflowPipeline.query.filter( OrganizationWorkflowPipeline.uuid == organization_workflow_pipeline.uuid).first() assert ow_pipeline.is_deleted is True
def test_delete_workflow_pipeline(app, workflow, workflow_pipeline): the_uuid = workflow_pipeline.uuid services.delete_workflow_pipeline(workflow.uuid, workflow_pipeline.uuid) assert workflow_pipeline.is_deleted assert find_workflow_pipeline(the_uuid) is None
def test_delete_workflow_pipeline_no_id(app, workflow): with pytest.raises(ValueError): services.delete_workflow_pipeline("no-id", "no-id") with pytest.raises(ValueError): services.delete_workflow_pipeline(workflow.uuid, "no-id")