def test_create_build_configuration(mock_environments, mock_projects, mock_create_new, mock_create_build_conf_object): result = buildconfigurations.create_build_configuration(name='testerino', description='test description', project=1, environment=1) mock_create_build_conf_object.assert_called_once_with(name='testerino', description='test description', project='mock-project', environment='mock-environment') mock_projects.assert_called_once_with(id=1) mock_environments.assert_called_once_with(id=1) mock_create_new.assert_called_once_with(body='test-build-config-object') assert result == 'test-build-config-object'
def create_build_configuration_with_repo(environment, bc_set, product_version_id, art_params, repository, scm_revision, artifact_name, project): buildconfigurations.create_build_configuration( name=artifact_name, project=project.id, environment=environment.id, repository_configuration=repository.id, scm_revision=scm_revision, build_script=get_maven_options(art_params), product_version_id=product_version_id, generic_parameters=get_generic_parameters(art_params)) build_config = get_build_configuration_by_name(artifact_name) if build_config == None: logging.error("Creation of Build Configuration failed.") return None logging.info("Build Configuration " + artifact_name + " is created.") return build_config
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
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
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
def test_create_build_configuration(mock_projects_api, mock_envs_api, mock_entity, mock_create_new, mock_create_build_conf_object): result = buildconfigurations.create_build_configuration( name='testerino', description='test description', project=1, environment=1) mock_create_build_conf_object.assert_called_once_with( name='testerino', description='test description', project='mock-entity', environment='mock-entity') mock_entity.assert_has_calls( [call(mock_envs_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'
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 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() 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( 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') def teardown(): buildconfigurations.delete_build_configuration(id=created_bc.id) request.addfinalizer(teardown) return created_bc
def test_create_build_configuration_no_environment(mock_environments, mock_project): result = buildconfigurations.create_build_configuration(name='testerino', project=1, environment=1) mock_project.assert_called_once_with(id=1) mock_environments.assert_called_once_with(id=1) assert not result