Example #1
0
def create_action(ctx, action_name, param):
    check_action_command(ctx, action_name)

    if not param and action_name is 'redeploy_server':
        ctx.fail('At least one parameter must be specified using '
                 '--param="<parameter>" with action redeploy_server')
    else:
        param = check_reformat_parameter(ctx, param)
        click.echo(
            CreateAction(ctx, action_name, param).invoke_and_return_resp())
Example #2
0
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
Example #3
0
def test_create_action(*args):
    responses.add(responses.POST,
                  'http://shiptest/actions',
                  body=resp_body,
                  status=201)
    response = CreateAction(stubs.StubCliContext(),
                            action_name='deploy_site',
                            param=None).invoke_and_return_resp()
    assert 'Name' in response
    assert 'Action' in response
    assert 'Lifecycle' in response
    assert 'action/01BTTMFVDKZFRJM80FGD7J1AKN' in response
    assert 'Error:' not in response
Example #4
0
def test_create_action_400(*args):
    responses.add(responses.POST,
                  'http://shiptest/actions',
                  body=stubs.gen_err_resp(message='Error_400',
                                          reason='bad action'),
                  status=400)
    response = CreateAction(
        stubs.StubCliContext(),
        action_name='deploy_dogs',
        param=None,
        allow_intermediate_commits=False).invoke_and_return_resp()
    assert 'Error_400' in response
    assert 'bad action' in response
    assert 'action/01BTTMFVDKZFRJM80FGD7J1AKN' not in response