def test_build_id_param_shorten_id(self): p = BuildIDParam() p.value = "x" * 63 val = p.value assert len(val) == 63
def __init__(self, build_json_dir=None, customize_conf=None): # defines image_tag, koji_target, filesystem_koji_task_id, platform, arrangement_version super(BuildUserParams, self).__init__() self.arrangement_version.value = REACTOR_CONFIG_ARRANGEMENT_VERSION self.base_image = BuildParam('base_image', allow_none=True) self.build_from = BuildParam('build_from') self.build_image = BuildParam('build_image') self.build_imagestream = BuildParam('build_imagestream') self.build_json_dir = BuildParam('build_json_dir', default=build_json_dir) self.build_type = BuildParam('build_type') self.component = BuildParam('component') self.compose_ids = BuildParam("compose_ids", allow_none=True) self.customize_conf_path = BuildParam("customize_conf", allow_none=True, default=customize_conf or DEFAULT_CUSTOMIZE_CONF) self.flatpak = BuildParam('flatpak', default=False) self.flatpak_base_image = BuildParam("flatpak_base_image", allow_none=True) self.git_branch = BuildParam('git_branch') self.git_ref = BuildParam('git_ref', default=DEFAULT_GIT_REF) self.git_uri = BuildParam('git_uri') self.imagestream_name = BuildParam('imagestream_name') self.isolated = BuildParam('isolated', allow_none=True) self.koji_parent_build = BuildParam('koji_parent_build', allow_none=True) self.koji_task_id = BuildParam('koji_task_id', allow_none=True) self.koji_upload_dir = BuildParam('koji_upload_dir', allow_none=True) self.name = BuildIDParam() self.platforms = BuildParam('platforms', allow_none=True) self.reactor_config_map = BuildParam("reactor_config_map", allow_none=True) self.reactor_config_override = BuildParam("reactor_config_override", allow_none=True) self.release = BuildParam('release', allow_none=True) self.scratch = BuildParam('scratch', allow_none=True) self.signing_intent = BuildParam('signing_intent', allow_none=True) self.trigger_imagestreamtag = BuildParam('trigger_imagestreamtag') self.user = UserParam() self.yum_repourls = BuildParam("yum_repourls") self.required_params = [ self.build_json_dir, self.build_type, self.git_ref, self.git_uri, self.koji_target, self.user, ] self.convert_dict = {} for _, param in self.__dict__.items(): if isinstance(param, BuildParam): # check that every parameter has a unique name if param.name in self.convert_dict: raise OsbsValidationException( 'Two user params with the same name') self.convert_dict[param.name] = param
def test_build_id_param_raise_exc(self): p = BuildIDParam() with pytest.raises(OsbsValidationException): p.value = r"\\\\@@@@||||"