def test_fetch_workflow_pipeline_invalid_org_workflow( app, organization_workflow, organization_pipeline, organization_workflow_pipeline): with pytest.raises(ValueError): fetch_workflow_pipeline( organization_workflow.organization_uuid, "1234", organization_workflow_pipeline.uuid, )
def test_fetch_workflow_pipeline_not_found(app, organization_workflow, organization_pipeline, organization_workflow_pipeline): wf_uuid = organization_workflow.workflow_uuid wf_pipeline_uuid = organization_workflow_pipeline.workflow_pipeline_uuid responses.add( responses.GET, f"{app.config[WORKFLOW_HOSTNAME]}/v1/workflows/{wf_uuid}/pipelines/{wf_pipeline_uuid}", json={"not": "found"}, status=404, ) with pytest.raises(ValueError): fetch_workflow_pipeline( organization_workflow.organization_uuid, organization_workflow.uuid, organization_workflow_pipeline.uuid, )
def test_fetch_workflow_pipeline_bad_json(app, organization_workflow, organization_pipeline, organization_workflow_pipeline): wf_uuid = organization_workflow.workflow_uuid wf_pipeline_uuid = organization_workflow_pipeline.workflow_pipeline_uuid responses.add( responses.GET, f"{app.config[WORKFLOW_HOSTNAME]}/v1/workflows/{wf_uuid}/pipelines/{wf_pipeline_uuid}", body="notjson", status=503, ) with pytest.raises(HTTPError): fetch_workflow_pipeline( organization_workflow.organization_uuid, organization_workflow.uuid, organization_workflow_pipeline.uuid, )
def workflow_pipeline( organization_uuid, organization_workflow_uuid, organization_workflow_pipeline_uuid ): """Get Organization Workflow Pipeline. --- tags: - workflows parameters: - in: header name: Workflow-API-Key description: Requires key type REACT_CLIENT schema: type: string responses: "200": description: "Get Organization Workflow Pipeline." content: application/json: schema: type: object properties: pipeline_uuid: type: string source_workflow_pipelines: type: array items: type: string destination_workflow_pipelines: type: array items: type: string uuid: type: string created_at: type: string updated_at: type: string "400": description: "Bad request" "503": description: "Http error" """ try: return jsonify( fetch_workflow_pipeline( organization_uuid, organization_workflow_uuid, organization_workflow_pipeline_uuid, ) ) 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_fetch_workflow_pipeline(app, organization_workflow, organization_pipeline, organization_workflow_pipeline): wf_uuid = organization_workflow.workflow_uuid wf_pipeline_uuid = organization_workflow_pipeline.workflow_pipeline_uuid responses.add( responses.GET, f"{app.config[WORKFLOW_HOSTNAME]}/v1/workflows/{wf_uuid}/pipelines/{wf_pipeline_uuid}", json=WORKFLOW_PIPELINE_RESPONSE_JSON, ) wf_pipeline = fetch_workflow_pipeline( organization_workflow.organization_uuid, organization_workflow.uuid, organization_workflow_pipeline.uuid, ) assert wf_pipeline.get("uuid") == organization_workflow_pipeline.uuid assert wf_pipeline.get("pipeline_uuid") == organization_pipeline.uuid assert organization_workflow_pipeline.uuid in wf_pipeline.get( "source_workflow_pipelines") assert organization_workflow_pipeline.uuid in wf_pipeline.get( "destination_workflow_pipelines")