Esempio n. 1
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
Esempio n. 2
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
Esempio n. 3
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
Esempio n. 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