def create_build_configuration_set(**kwargs): """ Create a new BuildConfigurationSet. """ name = kwargs.get('name') if get_build_config_set_id_by_name(name): logging.error("A BuildConfigurationSet with name {0} already exists.".format( name)) return version_id = kwargs.get('product_version_id') if version_id and not productversions.version_exists(version_id): logging.error("No ProductVersion with id {0} exists.".format(version_id)) return build_configurations = kwargs.get('build_configuration_ids') failed = False if build_configurations: for config in build_configurations: if not buildconfigurations.config_id_exists(config): logging.error( "No BuildConfiguration with id {0} exists.".format(config)) failed = True if failed: return config_set = _create_build_config_set_object(**kwargs) response = utils.checked_api_call(sets_api, 'create_new', body=config_set) if response: return response.content
def test_config_id_exists_false(mock): result = buildconfigurations.config_id_exists(5) mock.assert_called_once_with(id=5) assert not result
def test_config_id_exists(mock): result = buildconfigurations.config_id_exists(1) mock.assert_called_once_with(id=1) assert result