def test_get_configdocs(*args):
    responses.add(responses.GET,
                  'http://shiptest/configdocs/design?version=buffer',
                  body=GET_CONFIGDOCS_API_RESP,
                  status=200)
    response = GetConfigdocs(stubs.StubCliContext(),
                             collection='design',
                             version='buffer').invoke_and_return_resp()
    assert response == GET_CONFIGDOCS_API_RESP
Пример #2
0
def get_configdocs(ctx, collection, buffer, committed, last_site_action,
                   successful_site_action):
    if collection:
        # Get version
        version = get_version(ctx, buffer, committed, last_site_action,
                              successful_site_action)

        click.echo(
            GetConfigdocs(ctx, collection, version).invoke_and_return_resp())

    else:
        click.echo(GetConfigdocsStatus(ctx).invoke_and_return_resp())
def test_get_configdocs_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/configdocs/design?version=buffer',
                  body=api_resp,
                  status=404)
    response = GetConfigdocs(stubs.StubCliContext(),
                             collection='design',
                             version='buffer').invoke_and_return_resp()
    assert 'Error: Not Found' in response
    assert 'Reason: It does not exist' in response
Пример #4
0
def get_configdocs(ctx, collection, buffer, committed):
    if collection:
        if buffer and committed:
            ctx.fail(
                'You must choose whether to retrive the committed OR from the '
                'Shipyard Buffer with --committed or --buffer. ')

        if committed:
            version = 'committed'

        else:
            version = 'buffer'

        click.echo(
            GetConfigdocs(ctx, collection, version).invoke_and_return_resp())
    else:
        click.echo(GetConfigdocsStatus(ctx).invoke_and_return_resp())
Пример #5
0
def get_configdocs(ctx, collection, buffer, committed, last_site_action,
                   successful_site_action, cleartext_secrets):
    if collection:
        # Get version
        _version = get_version(ctx, buffer, committed, last_site_action,
                               successful_site_action)

        click.echo(
            GetConfigdocs(ctx, collection, _version,
                          cleartext_secrets).invoke_and_return_resp())

    else:
        compare_versions = check_reformat_versions(ctx, buffer, committed,
                                                   last_site_action,
                                                   successful_site_action)

        click.echo(
            GetConfigdocsStatus(ctx,
                                compare_versions).invoke_and_return_resp())