def test_create_action_409(*args):
    responses.add(responses.POST,
                  'http://shiptest/actions',
                  body=stubs.gen_err_resp(message='Error_409',
                                          reason='bad validations'),
                  status=409)
    response = CreateAction(stubs.StubCliContext(),
                            action_name='deploy_site',
                            param=None).invoke_and_return_resp()
    assert 'Error_409' in response
    assert 'bad validations' in response
    assert 'action/01BTTMFVDKZFRJM80FGD7J1AKN' not in response
Beispiel #2
0
def test_describe_action_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/actions/01BTTMFVDKZFRJM80FGD7J1AKN',
                  body=api_resp,
                  status=404)

    response = DescribeAction(
        stubs.StubCliContext(),
        '01BTTMFVDKZFRJM80FGD7J1AKN').invoke_and_return_resp()
    assert 'Error: Not Found' in response
    assert 'Reason: It does not exist' in response
Beispiel #3
0
def test_commit_configdocs_forced(*args):
    api_resp = stubs.gen_err_resp(message="Conflicts message forced",
                                  sub_message='Another bucket message',
                                  sub_error_count=1,
                                  sub_info_count=0,
                                  reason='Conflicts reason',
                                  code=200)
    responses.add(responses.POST,
                  'http://shiptest/commitconfigdocs?force=true',
                  body=api_resp,
                  status=200)
    response = CommitConfigdocs(stubs.StubCliContext(), True,
                                False).invoke_and_return_resp()
    assert 'Status: Conflicts message forced' in response
    assert 'Configuration documents committed' in response
    assert 'Reason: Conflicts reason' in response
Beispiel #4
0
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
def test_create_configdocs(*args):
    succ_resp = stubs.gen_err_resp(message='Validations succeeded',
                                   sub_error_count=0,
                                   sub_info_count=0,
                                   reason='Validation',
                                   code=200)
    responses.add(responses.POST,
                  'http://shiptest/configdocs/design',
                  body=succ_resp,
                  status=201)

    filename = 'shipyard_client/tests/unit/cli/create/sample_yaml/sample.yaml'
    document_data = yaml.dump_all(filename)
    file_list = (filename, )

    response = CreateConfigdocs(stubs.StubCliContext(), 'design', 'append',
                                document_data,
                                file_list).invoke_and_return_resp()
    assert 'Configuration documents added.'
    assert 'Status: Validations succeeded' in response
    assert 'Reason: Validation' in response
def test_create_configdocs_409(*args):
    err_resp = stubs.gen_err_resp(message='Invalid collection',
                                  sub_message='Buffer is either not...',
                                  sub_error_count=1,
                                  sub_info_count=0,
                                  reason='Buffermode : append',
                                  code=409)
    responses.add(responses.POST,
                  'http://shiptest/configdocs/design',
                  body=err_resp,
                  status=409)

    filename = 'shipyard_client/tests/unit/cli/create/sample_yaml/sample.yaml'
    document_data = yaml.dump_all(filename)
    file_list = (filename, )

    response = CreateConfigdocs(stubs.StubCliContext(), 'design', 'append',
                                document_data,
                                file_list).invoke_and_return_resp()
    assert 'Error: Invalid collection' in response
    assert 'Reason: Buffermode : append' in response
    assert 'Buffer is either not...' in response