Пример #1
0
def test_create_build_configuration(mock_repos_api, mock_projects_api, mock_envs_api, mock_entity, mock_create_new,
                                    mock_create_build_conf_object):
    result = buildconfigurations.create_build_configuration_raw(name='testerino', description='test description', project=1,
                                                            environment=1, repository_configuration=1)
    mock_create_build_conf_object.assert_called_once_with(name='testerino', description='test description',
                                                          project='mock-entity', environment='mock-entity',
                                                          repository_configuration="mock-entity")
    mock_entity.assert_has_calls([call(mock_envs_api, 1), call(mock_repos_api, 1), call(mock_projects_api, 1)])
    mock_create_new.assert_called_once_with(body='test-build-config-object')
    assert result == 'test-build-config-object'
Пример #2
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
Пример #3
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
Пример #4
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_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)