Beispiel #1
0
 def _create_random_ca(cls):
     """Create CustomAttribute entity with randomly filled fields."""
     random_ca = CustomAttributeEntity()
     random_ca.type = cls.obj_ca
     random_ca.attribute_type = unicode(
         random.choice(AdminWidgetCustomAttributes.ALL_CA_TYPES))
     random_ca.title = cls.generate_string(random_ca.attribute_type)
     if random_ca.attribute_type == AdminWidgetCustomAttributes.DROPDOWN:
         random_ca.multi_choice_options = random_list_strings()
     random_ca.definition_type = unicode(
         objects.get_singular(random.choice(objects.ALL_CA_OBJS)))
     random_ca.mandatory = False
     return random_ca
 def create_dashboard_ca(cls, definition_type):
     """Create and return CA entity with valid filled fields for
 creating N'Dashboard'.
 """
     dashboard_ca = CustomAttributeEntity()
     dashboard_ca.type = cls.obj_ca
     dashboard_ca.attribute_type = AdminWidgetCustomAttributes.TEXT
     dashboard_ca.title = cls.generate_string(value_aliases.DASHBOARD)
     dashboard_ca.mandatory = False
     dashboard_ca.definition_type = definition_type
     return dashboard_ca
Beispiel #3
0
 def _set_custom_attributes_list(self):
   """Set custom attributes list with Custom Attribute objects from
   current opened content item.
   """
   for row in selenium_utils.get_when_all_visible(self._driver,
                                                  self._locators.ROW):
     attrs = [i.text for i in row.find_elements(*self._locators.CELL_IN_ROW)]
     self.custom_attributes_list.append(
         CustomAttributeEntity(
             title=attrs[0],
             type=objects.get_singular(objects.CUSTOM_ATTRIBUTES),
             attribute_type=attrs[1],
             mandatory=get_bool_value_from_arg(attrs[2]),
             definition_type=self._item_name))
Beispiel #4
0
 def _create_random_ca(cls):
   """Create CustomAttribute entity with randomly filled fields."""
   random_ca = CustomAttributeEntity()
   random_ca.type = cls.obj_ca
   random_ca.attribute_type = unicode(random.choice(
       AdminWidgetCustomAttributes.ALL_CA_TYPES))
   random_ca.title = cls.generate_string(random_ca.attribute_type)
   if random_ca.attribute_type == AdminWidgetCustomAttributes.DROPDOWN:
     random_ca.multi_choice_options = random_list_strings()
   random_ca.definition_type = unicode(objects.get_singular(
       random.choice(objects.ALL_CA_OBJS)))
   random_ca.mandatory = False
   return random_ca
Beispiel #5
0
 def _set_custom_attributes_list(self):
     """Set custom attributes list with Custom Attribute objects from
 current opened content item.
 """
     for elem in selenium_utils.get_when_all_visible(
             self._driver, self._locators.ROW):
         attr = [
             i.text for i in elem.find_elements(*self._locators.CELL_IN_ROW)
         ]
         self.custom_attributes_list.append(
             CustomAttributeEntity(title=attr[0],
                                   ca_type=attr[1],
                                   is_mandatory=get_bool_from_string(
                                       attr[2]),
                                   definition_type=self._item_name))
Beispiel #6
0
 def create_dashboard_ca(cls, definition_type):
   """Create and return CA entity with valid filled fields for
   creating N'Dashboard'.
   """
   dashboard_ca = CustomAttributeEntity()
   dashboard_ca.type = cls.obj_ca
   dashboard_ca.attribute_type = AdminWidgetCustomAttributes.TEXT
   dashboard_ca.title = cls.generate_string(value_aliases.DASHBOARD)
   dashboard_ca.mandatory = False
   dashboard_ca.definition_type = definition_type
   return dashboard_ca