示例#1
0
def describe_workflow(ctx, workflow_id):

    if not workflow_id:
        ctx.fail("An action id argument must be passed.")

    check_workflow_id(ctx, workflow_id)

    click.echo(DescribeWorkflow(ctx, workflow_id).invoke_and_return_resp())
def test_describe_workflow(*args):
    responses.add(
        responses.GET,
        'http://shiptest/workflows/deploy_site__2017-10-09T21:19:03.000000',
        body=WF_API_RESP,
        status=200)

    response = DescribeWorkflow(
        stubs.StubCliContext(),
        'deploy_site__2017-10-09T21:19:03.000000').invoke_and_return_resp()
    assert 'deploy_site__2017-10-09T21:19:03.000000' in response
    assert 'deploy_site.preflight__2017-10-09T21:19:03.000000' in response
    assert 'deploy_site.postflight__2017-10-09T21:19:03.000000' in response
    assert 'dag_concurrency_check' in response
    assert 'Subworkflows:' in response
def test_describe_workflow_not_found(*args):
    api_resp = stubs.gen_err_resp(message='Not Found',
                                  sub_error_count=0,
                                  sub_info_count=0,
                                  reason='It does not exist',
                                  code=404)
    responses.add(
        responses.GET,
        'http://shiptest/workflows/deploy_site__2017-10-09T21:19:03.000000',
        body=api_resp,
        status=404)

    response = DescribeWorkflow(
        stubs.StubCliContext(),
        'deploy_site__2017-10-09T21:19:03.000000').invoke_and_return_resp()
    assert 'Error: Not Found' in response
    assert 'Reason: It does not exist' in response