def describe_validation(ctx, validation_id, action): check_id(ctx, validation_id) check_id(ctx, action) click.echo( DescribeValidation(ctx, validation_id, action).invoke_and_return_resp())
def describe_action(ctx, action_id): if not action_id: ctx.fail("An action id argument must be passed.") check_id(ctx, action_id) click.echo(DescribeAction(ctx, action_id).invoke_and_return_resp())
def describe_notedetails(ctx, note_id): if not note_id: ctx.fail("A note id argument must be passed.") check_id(ctx, note_id) click.echo(DescribeNotedetails(ctx, note_id).invoke_and_return_resp())
def test_check_id_none(): ctx = Mock(side_effect=Exception("failed")) try: input_checks.check_id(ctx, None) except Exception: pass # py 3.6: ctx.fail.assert_called() assert 'call.fail(' in str(ctx.mock_calls[0])
def test_check_id_bad_chars(): ctx = Mock(side_effect=Exception("failed")) try: input_checks.check_id(ctx, "_ARENOTALLOWED-") except Exception: pass # py 3.6: ctx.fail.assert_called() assert 'call.fail(' in str(ctx.mock_calls[0])
def test_check_id_too_short(): ctx = Mock(side_effect=Exception("failed")) try: input_checks.check_id(ctx, "TOOSHORT") except Exception: pass # py 3.6: ctx.fail.assert_called() assert 'call.fail(' in str(ctx.mock_calls[0])
def control_command(ctx, action, target_type, id): """ For more information on the control commands (pause, unpause, stop), please enter 'shipyard control <control command> --help.' """ check_control_action(ctx, action) if id: check_id(ctx, id) ctx.invoke(getattr(control, 'control_' + action), target_type=target_type, id=id) else: ctx.invoke(getattr(control, 'control_' + action), target_type=target_type)
def describe_step(ctx, step_id, action): check_id(ctx, action) click.echo(DescribeStep(ctx, action, step_id).invoke_and_return_resp())
def test_check_id_valid(): ctx = Mock(side_effect=Exception("failed")) input_checks.check_id(ctx, "12345678901234567890123456") ctx.fail.assert_not_called()