Exemplo n.º 1
0
def test_update(new_project):
    newname = 'newname' + testutils.gen_random_name()
    updated_project = projects._create_project_object(
        name=newname, description="pnc-cli test updated description")
    projects_api.update(id=new_project.id, body=updated_project)
    retrieved_project = projects_api.get_specific(new_project.id).content
    assert retrieved_project.name == newname and retrieved_project.description == 'pnc-cli test updated description'
Exemplo n.º 2
0
def test_update(new_set):
    newname = "newname" + testutils.gen_random_name()
    updated_set = buildconfigurationsets._create_build_config_set_object(
        name=newname)
    sets_api.update(id=new_set.id, body=updated_set)
    retrieved_set = sets_api.get_specific(id=new_set.id).content
    assert retrieved_set.name == newname
Exemplo n.º 3
0
def test_update(new_product):
    NEW_DESC = 'PNC CLI: test_products_api updated description'
    newname = 'newname' + testutils.gen_random_name()
    product_api.update(id=new_product.id,
                       body=products._create_product_object(name=newname, description=NEW_DESC))
    updated_prod = product_api.get_specific(id=new_product.id).content
    assert updated_prod.name == newname and updated_prod.description == NEW_DESC
Exemplo n.º 4
0
def new_license(request):
    license = licenses_api.create_new(body=licenses._create_license_object(full_name=testutils.gen_random_name(),
                                                                           full_content="pnc_cli-cli test license")).content
    def teardown():
        licenses.delete_license(license.id)
    request.addfinalizer(teardown)
    return license
Exemplo n.º 5
0
def test_update(new_product):
    new_desc = 'PNC CLI: test_products_api updated description'
    new_abbreviation = testutils.gen_random_name()
    newname = 'newname-' + new_abbreviation
    product_api.update(id=new_product.id,
                       body=products.create_product_object(name=newname, abbreviation=new_abbreviation, description=new_desc))
    updated_prod = product_api.get_specific(id=new_product.id).content
    assert updated_prod.name == newname and updated_prod.description == new_desc and updated_prod.abbreviation == new_abbreviation
Exemplo n.º 6
0
def new_set(new_project, new_environment):
    config_one = new_config(new_project, new_environment)
    config_two = new_config(new_project, new_environment)
    config_three = new_config(new_project, new_environment)
    created_set = buildconfigurationsets.create_build_configuration_set(
        name=testutils.gen_random_name() + '-set-running-builds-test',
        build_configuration_ids=[config_one.id, config_two.id, config_three.id])
    return created_set
Exemplo n.º 7
0
def new_project(request):
    project = projects.create_project(name=testutils.gen_random_name() + '-project',
                                      description="PNC CLI: test project")

    def teardown():
        projects.delete_project(id=project.id)

    request.addfinalizer(teardown)
    return project
Exemplo n.º 8
0
def new_project(request):
    project = projects.create_project_raw(name=testutils.gen_random_name() + '-project',
                                      description="PNC CLI: test project")

    def teardown():
        projects.delete_project(id=project.id)

    request.addfinalizer(teardown)
    return project
Exemplo n.º 9
0
def new_set(request):
    set = buildconfigurationsets.create_build_configuration_set(name=testutils.gen_random_name() + "-set",
                                                                product_version_id=1)

    def teardown():
        buildconfigurationsets.delete_build_configuration_set(id=set.id)

    request.addfinalizer(teardown)
    return set
Exemplo n.º 10
0
def new_set(request):
    set = buildconfigurationsets.create_build_configuration_set_raw(
        name=testutils.gen_random_name() + "-set", product_version_id=1)

    def teardown():
        buildconfigurationsets.delete_build_configuration_set_raw(id=set.id)

    request.addfinalizer(teardown)
    return set
def new_config(new_project, new_environment):
    created_bc = buildconfigurations.create_build_configuration(name=testutils.gen_random_name(),
                                                                project=new_project.id,
                                                                environment=new_environment.id,
                                                                build_status="UNKNOWN",
                                                                build_script='mvn clean install',
                                                                product_version_ids=[1],
                                                                scm_repo_url='https://github.com/project-ncl/pnc-simple-test-project.git')

    return created_bc
Exemplo n.º 12
0
def new_license(request):
    license = licenses_api.create_new(body=licenses.create_license_object(
        full_name=testutils.gen_random_name(),
        full_content="pnc_cli-cli test license")).content

    def teardown():
        licenses.delete_license(license.id)

    request.addfinalizer(teardown)
    return license
Exemplo n.º 13
0
def test_update(new_env):
    randname = testutils.gen_random_name()
    updated_env = environments._create_environment_object(description="DOCKER", build_type='NATIVE', name=randname, image_id=randname)
    envs_api.update(id=new_env.id, body=updated_env)
    retrieved_env = envs_api.get_specific(new_env.id).content
    assert (retrieved_env.description == 'DOCKER')
    assert (retrieved_env.build_type == 'NATIVE')
    assert (retrieved_env.name == randname)
    #image_id is immutable; it should remain the same
    assert (retrieved_env.image_id == retrieved_env.image_id)
Exemplo n.º 14
0
def new_environment(request):
    randname = testutils.gen_random_name()
    env = environments.create_environment(name=randname,
                                          image_id=randname,
                                          system_image_type="DOCKER_IMAGE")

    def teardown():
        environments.delete_environment(id=env.id)

    request.addfinalizer(teardown)
    return env
Exemplo n.º 15
0
def test_update(new_environment):
    randname = testutils.gen_random_name()
    updated_env = environments._create_environment_object(name=randname, system_image_type='VIRTUAL_MACHINE_RAW', description='DOCKER',
                                                          image_id=randname)
    envs_api.update(id=new_environment.id, body=updated_env)
    retrieved_env = envs_api.get_specific(new_environment.id).content
    assert (retrieved_env.description == 'DOCKER')
    assert (retrieved_env.name == randname)
    # the following fields are immutable, and should remain unchanged
    assert (retrieved_env.image_id == retrieved_env.image_id)
    assert (retrieved_env.system_image_type == 'DOCKER_IMAGE')
Exemplo n.º 16
0
def new_config(new_project, new_environment):
    created_bc = configs_api.create_new(
        body=buildconfigurations.create_build_conf_object(
            name=testutils.gen_random_name() + '-config-running-builds-test',
            project=new_project,
            environment=new_environment,
            build_status="UNKNOWN",
            build_script='mvn clean install',
            product_version_ids=[1],
            scm_repo_url='https://github.com/project-ncl/pnc-simple-test-project.git',
            scm_revision='master')).content

    return created_bc
Exemplo n.º 17
0
def new_config(request, new_project, new_environment):
    created_bc = buildconfigurations.create_build_configuration(
        name=testutils.gen_random_name() + '-config',
        project=new_project.id,
        environment=new_environment.id,
        build_script='mvn javadoc:jar install',
        product_version_ids=[1],
        scm_repo_url='https://github.com/project-ncl/pnc-simple-test-project.git',
        scm_revision='1.0')

    def teardown():
        buildconfigurations.delete_build_configuration(id=created_bc.id)

    request.addfinalizer(teardown)
    return created_bc
Exemplo n.º 18
0
def new_config(request, new_project):
    created_bc = buildconfigurations.create_build_configuration(
        name=testutils.gen_random_name() + '-config',
        project=new_project.id,
        environment=1,
        build_script='mvn javadoc:jar deploy',
        product_version_id=1,
        scm_repo_url=
        'git+ssh://[email protected]:29418',
        scm_revision='1.0')

    def teardown():
        buildconfigurations.delete_build_configuration(id=created_bc.id)

    request.addfinalizer(teardown)
    return created_bc
Exemplo n.º 19
0
def create_config(request, new_project, new_version, project_number):
    if (project_number == 2):
        ending = '-2'
    elif (project_number == 3):
        ending = '-3'
    else:
        ending = ''

    # detect our environment to assign appropriate internal repository
    if "stage" in uc.user.pnc_config.url:
        repo_url = 'git+ssh://[email protected]:29418/productization/github.com/pnc-simple-test-project'+ending+'.git'
    elif "devel" in uc.user.pnc_config.url:
        repo_url = 'git+ssh://[email protected]:29418/productization/github.com/pnc-simple-test-project'+ending+'.git'

    # detect an appropriate environment
    available_environments = environments.list_environments_raw()

    for x in available_environments:
        # set the env_id to one of the environments. This allows us to set
        # env_id to an existing environment id even if no environment contains
        # "OpenJDK 1.8.0; Mvn 3.3.9" 
        env_id = x.id
        if "OpenJDK 1.8.0; Mvn 3.3.9" in x.name:
            env_id = x.id
            break



    bc_name = testutils.gen_random_name() + '-config'
    created_bc = buildconfigurations.create_build_configuration_raw(
        name=bc_name,
        project=new_project.id,
        environment=env_id,
        build_script='mvn deploy',
        product_version_id=new_version.id,
        scm_repo_url=repo_url,
        scm_revision='master',
        repository_configuration=1)

    def teardown():
        buildconfigurations.delete_build_configuration(id=created_bc.id)

    request.addfinalizer(teardown)
    return created_bc
Exemplo n.º 20
0
def create_config(request, new_project, new_version, project_number):
    if (project_number == 2):
        ending = '-2'
    elif (project_number == 3):
        ending = '-3'
    else:
        ending = ''

    # detect our environment to assign appropriate internal repository
    if "stage" in uc.user.pnc_config.url:
        repo_url = 'git+ssh://[email protected]:29418/productization/github.com/pnc-simple-test-project'+ending+'.git'
    elif "devel" in uc.user.pnc_config.url:
        repo_url = 'git+ssh://[email protected]:29418/productization/github.com/pnc-simple-test-project'+ending+'.git'

    # detect an appropriate environment
    available_environments = environments.list_environments_raw()

    for x in available_environments:
        # set the env_id to one of the environments. This allows us to set
        # env_id to an existing environment id even if no environment contains
        # "OpenJDK 1.8.0; Mvn 3.3.9" 
        env_id = x.id
        if "OpenJDK 1.8.0; Mvn 3.3.9" in x.name:
            env_id = x.id
            break



    bc_name = testutils.gen_random_name() + '-config'
    created_bc = buildconfigurations.create_build_configuration_raw(
        name=bc_name,
        project=new_project.id,
        environment=env_id,
        build_script='mvn deploy',
        product_version_id=new_version.id,
        scm_repo_url=repo_url,
        scm_revision='master',
        repository_configuration=1)

    def teardown():
        buildconfigurations.delete_build_configuration_raw(id=created_bc.id)

    request.addfinalizer(teardown)
    return created_bc
Exemplo n.º 21
0
def test_dependency_operations(new_config):
    # again detect environment
    if "stage" in uc.user.pnc_config.url:
        repo_url = 'git+ssh://[email protected]:29418/productization/github.com/pnc-simple-test-project.git'
    elif "devel" in uc.user.pnc_config.url:
        repo_url = 'git+ssh://[email protected]:29418/productization/github.com/pnc-simple-test-project.git'

    depname = testutils.gen_random_name()
    dep = buildconfigurations.create_build_configuration(name=depname, project=new_config.project.id, environment=new_config.environment.id,
                                                         scm_repo_url=repo_url,
                                                         scm_revision='master')
    configs_api.add_dependency(id=new_config.id, body=dep)
    dependency_ids = [dep.id for dep in
                      configs_api.get_dependencies(id=new_config.id, page_index=0, page_size=1000000, sort='',
                                                   q='').content]
    assert dep.id in dependency_ids
    configs_api.remove_dependency(id=new_config.id, dependency_id=dep.id)
    assert not configs_api.get_dependencies(id=new_config.id).content
    configs_api.delete_specific(id=dep.id)
def test_dependency_operations(new_config):
    # again detect environment
    if "stage" in uc.user.pnc_config.url:
        repo_url = 'git+ssh://[email protected]:29418/productization/github.com/pnc-simple-test-project.git'
    elif "devel" in uc.user.pnc_config.url:
        repo_url = 'git+ssh://[email protected]:29418/productization/github.com/pnc-simple-test-project.git'

    depname = testutils.gen_random_name()
    dep = buildconfigurations.create_build_configuration_raw(name=depname, project=new_config.project.id, environment=new_config.environment.id,
                                                         scm_repo_url=repo_url,
                                                         scm_revision='master',
                                                         repository_configuration=1)
    configs_api.add_dependency(id=new_config.id, body=dep)
    dependency_ids = [dep.id for dep in
                      configs_api.get_dependencies(id=new_config.id, page_index=0, page_size=1000000, sort='',
                                                   q='').content]
    assert dep.id in dependency_ids
    configs_api.remove_dependency(id=new_config.id, dependency_id=dep.id)
    assert not configs_api.get_dependencies(id=new_config.id).content
    configs_api.delete_specific(id=dep.id)
Exemplo n.º 23
0
def test_update(new_project):
    newname = 'newname' + testutils.gen_random_name()
    updated_project = projects._create_project_object(name=newname, description="pnc-cli test updated description")
    projects_api.update(id=new_project.id, body=updated_project)
    retrieved_project = projects_api.get_specific(new_project.id).content
    assert retrieved_project.name == newname and retrieved_project.description == 'pnc-cli test updated description'
def test_update(new_set):
    newname = "newname" + testutils.gen_random_name()
    updated_set = buildconfigurationsets._create_build_config_set_object(name=newname)
    sets_api.update(id=new_set.id, body=updated_set)
    retrieved_set = sets_api.get_specific(id=new_set.id).content
    assert retrieved_set.name == newname
Exemplo n.º 25
0
def new_product():
    randname = testutils.gen_random_name()
    product = products.create_product_raw(randname + "-product",
                                      randname,
                                      description="PNC CLI: test product")
    return product
Exemplo n.º 26
0
def new_product():
    product_api = ProductsApi(utils.get_api_client())
    product = product_api.create_new(body=products._create_product_object(name=testutils.gen_random_name(),
                                                                          description="PNC CLI: test_productversions_api product"
                                                                          )).content
    return product
Exemplo n.º 27
0
def new_product():
    product = product_api.create_new(body=products._create_product_object(name=testutils.gen_random_name(),
                                                                          description="PNC-CLI: test_products_api product"
                                                                          )).content
    return product
def new_environment():
    randname = testutils.gen_random_name()
    env = environments.create_environment(name=randname + '_environment', build_type='JAVA', image_id=randname)
    return env
def new_project():
    project = projects.create_project(name=testutils.gen_random_name() + '_project')
    return project
def new_set():
    set = sets_api.create_new(
        body=buildconfigurationsets._create_build_config_set_object(name=testutils.gen_random_name(),
                                                                    productVersionId=1)).content
    return set
Exemplo n.º 31
0
def test_update(new_product):
    newname = 'newname' + testutils.gen_random_name()
    product_api.update(id=new_product.id,
                       body=products._create_product_object(name=newname, description='pnc-cli test updated description'))
    updated_prod = product_api.get_specific(id=new_product.id).content
    assert updated_prod.name == newname and updated_prod.description == 'pnc-cli test updated description'
Exemplo n.º 32
0
def new_product():
    product = products.create_product(name=testutils.gen_random_name() + "-product",
                                      description="PNC CLI: test product")
    return product
Exemplo n.º 33
0
def new_product():
    randname = testutils.gen_random_name()
    product = products.create_product_raw(randname + "-product",
                                          randname,
                                          description="PNC CLI: test product")
    return product
Exemplo n.º 34
0
def new_project(request):
    project = projects_api.create_new(body=projects._create_project_object(name=testutils.gen_random_name())).content
    return project
Exemplo n.º 35
0
def new_env(request):
    randname = testutils.gen_random_name()
    env = envs_api.create_new(
        body=environments._create_environment_object(name=randname, build_type='JAVA', image_id=randname)).content
    return env