Example #1
0
def unique_bc_name(name_input):
    valid_bc_name(name_input)
    if common.get_id_by_name(pnc_api.build_configs, name_input):
        raise argparse.ArgumentTypeError(
            "BuildConfiguration name '{}' is already in use".format(
                name_input))
    return name_input
Example #2
0
def unique_product_name(name_input):
    if common.get_id_by_name(pnc_api.products, name_input):
        raise argparse.ArgumentTypeError(
            "a Product with the name {} already exists".format(name_input))
    return name_input
Example #3
0
def existing_product_name(name_input):
    if not common.get_id_by_name(pnc_api.products, name_input):
        raise argparse.ArgumentTypeError(
            "no Product with the name {} exists".format(name_input))
    return name_input
Example #4
0
def existing_bc_name(name_input):
    valid_bc_name(name_input)
    if not common.get_id_by_name(pnc_api.build_configs, name_input):
        raise argparse.ArgumentTypeError(
            "no BuildConfiguration with the name {} exists".format(name_input))
    return name_input
Example #5
0
def unique_environment_name(nameInput):
    if common.get_id_by_name(pnc_api.environments, nameInput):
        raise argparse.ArgumentTypeError(
            "a BuildEnvironment with name {} already exists".format(nameInput))
    return nameInput
Example #6
0
def unique_product_name(name_input):
    if common.get_id_by_name(pnc_api.products, name_input):
        raise argparse.ArgumentTypeError("a Product with the name {} already exists".format(name_input))
    return name_input
Example #7
0
def existing_environment_name(name_input):
    if not common.get_id_by_name(pnc_api.environments, name_input):
        raise argparse.ArgumentTypeError(
            "no BuildEnvironment exists with name {}".format(name_input))
    return name_input
Example #8
0
def existing_bc_name(name_input):
    valid_bc_name(name_input)
    if not common.get_id_by_name(pnc_api.build_configs, name_input):
        raise argparse.ArgumentTypeError("no BuildConfiguration with the name {} exists".format(name_input))
    return name_input
Example #9
0
def existing_product_name(name_input):
    if not common.get_id_by_name(pnc_api.products, name_input):
        raise argparse.ArgumentTypeError("no Product with the name {} exists".format(name_input))
    return name_input
Example #10
0
def unique_environment_name(nameInput):
    if common.get_id_by_name(pnc_api.environments, nameInput):
        raise argparse.ArgumentTypeError("a BuildEnvironment with name {} already exists".format(nameInput))
    return nameInput
Example #11
0
def unique_bc_name(name_input):
    valid_bc_name(name_input)
    if common.get_id_by_name(pnc_api.build_configs, name_input):
        raise argparse.ArgumentTypeError("BuildConfiguration name '{}' is already in use".format(name_input))
    return name_input
Example #12
0
def existing_environment_name(name_input):
    if not common.get_id_by_name(pnc_api.environments, name_input):
        raise argparse.ArgumentTypeError("no BuildEnvironment exists with name {}".format(name_input))
    return name_input
Example #13
0
def existing_bc_set_name(name_input):
    if not common.get_id_by_name(sets_api, name_input):
        raise argparse.ArgumentTypeError(
            "no BuildConfigurationSet with the name {} exists".format(
                name_input))
    return name_input
Example #14
0
def unique_bc_set_name(name_input):
    if common.get_id_by_name(sets_api, name_input):
        raise argparse.ArgumentTypeError(
            "BuildConfigurationSet name '{}' is already in use".format(
                name_input))
    return name_input
Example #15
0
def test_get_id_by_name_notfound():
    mock_api = create_autospec(BuildconfigurationsApi)
    mock_api.get_all.return_value = MagicMock(content=[])
    result = common.get_id_by_name(mock_api, 'testerino')
    assert not result
Example #16
0
def test_get_id_by_name():
    mock_api = create_autospec(BuildconfigurationsApi)
    mock_api.get_all.return_value = utils.create_mock_list_with_name_attribute()
    result = common.get_id_by_name(mock_api, 'testerino')
    assert result == 1