示例#1
0
def workflow_delete(organization_uuid, organization_workflow_uuid):
    """Delete a Organization Workflow.
    ---
    tags:
      - workflows
    parameters:
      - in: header
        name: Workflow-API-Key
        description: Requires key type REACT_CLIENT
        schema:
          type: string
    responses:
      "200":
        description: "Updated OrganizationWorkflow"
      "400":
        description: "Bad request"
      "503":
        description: "Http error"
    """

    try:
        delete_workflow(organization_uuid, organization_workflow_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
示例#2
0
def test_delete_workflow_not_found_workflow(app, organization_workflow):
    responses.add(
        responses.DELETE,
        f"{app.config[WORKFLOW_HOSTNAME]}/v1/workflows/{organization_workflow.workflow_uuid}",
        json={"error": "not found"},
        status=404,
    )

    with pytest.raises(HTTPError):
        delete_workflow(ORGANIZATION_UUID, organization_workflow.uuid)
示例#3
0
def test_delete_workflow(app, organization_workflow):
    responses.add(
        responses.DELETE,
        f"{app.config[WORKFLOW_HOSTNAME]}/v1/workflows/{organization_workflow.workflow_uuid}",
        json={},
        status=200,
    )

    delete_workflow(ORGANIZATION_UUID, organization_workflow.uuid)

    org_workflow = OrganizationWorkflow.query.filter(
        OrganizationWorkflow.uuid == organization_workflow.uuid).one()

    assert org_workflow.is_deleted
示例#4
0
def test_delete_workflow_not_found(app, organization_workflow):
    with pytest.raises(ValueError):
        delete_workflow(ORGANIZATION_UUID, "1234")
示例#5
0
def test_delete_workflow(app, workflow):
    the_uuid = workflow.uuid
    services.delete_workflow(the_uuid)
    assert find_workflow(the_uuid) is None
示例#6
0
def test_delete_workflow_no_id(app):
    with pytest.raises(ValueError):
        services.delete_workflow("no-id")
示例#7
0
def test_delete_workflow_pipeline_via_delete_workflow(app, workflow,
                                                      workflow_pipeline):
    services.delete_workflow(workflow.uuid)
    assert find_workflow_pipeline(workflow_pipeline.uuid) is None