Ejemplo n.º 1
0
def create_asmt_template(audit, **attrs):
    """Create assessment template."""
    obj_attrs, cad_attrs = _split_attrs(attrs,
                                        ["cad_type", "dropdown_types_list"])
    if "cad_type" in cad_attrs:
        cads = [
            entities_factory.AssessmentTemplatesFactory.generate_cad(
                **cad_attrs)
        ]
        obj_attrs["custom_attribute_definitions"] = cads
    obj_attrs["audit"] = audit.__dict__
    return rest_service.AssessmentTemplatesService().create_obj(
        factory_params=obj_attrs)
Ejemplo n.º 2
0
def create_asmt_template(audit, all_cad_types=False, **attrs):
  """Create assessment template."""
  from lib.constants.element import AdminWidgetCustomAttributes
  obj_attrs, cad_attrs = _split_attrs(
      attrs, ["cad_type", "dropdown_types_list"])
  cads = []
  if all_cad_types:
    for cad_type in AdminWidgetCustomAttributes.ALL_CA_TYPES:
      cads.append(entities_factory.AssessmentTemplatesFactory.generate_cad(
          cad_type=cad_type))
  if "cad_type" in cad_attrs:
    cads = [entities_factory.AssessmentTemplatesFactory.generate_cad(
        **cad_attrs)]
  obj_attrs["custom_attribute_definitions"] = cads
  obj_attrs["audit"] = audit.__dict__
  return rest_service.AssessmentTemplatesService().create_obj(
      factory_params=obj_attrs)
Ejemplo n.º 3
0
def create_asmt_template(audit, **attrs):
    """Create assessment template."""
    attrs["audit"] = audit.__dict__
    return rest_service.AssessmentTemplatesService().create_obj(**attrs)
Ejemplo n.º 4
0
def create_assessment_template(audit, **attrs):
    """Create an assessment template"""
    return rest_service.AssessmentTemplatesService().create_obj(
        audit=audit.__dict__, factory_params=attrs)