Ejemplo n.º 1
0
 def generate_string(cls, first_part):
   """Generate string in unicode format according object type and random data.
   """
   special_chars = string_utils.SPECIAL
   return unicode("{first_part}_{uuid}_{rand_str}".format(
       first_part=first_part, uuid=random_uuid(),
       rand_str=random_string(size=len(special_chars), chars=special_chars)))
Ejemplo n.º 2
0
 def test_dashboard_gca(self, new_control_rest, selenium, base_url):
   # pylint: disable=anomalous-backslash-in-string
   """Check Dashboard Tab is exist if 'Dashboard' GCA filled
   with right value. Possible values match to regexp r"^https?://[^\s]+$".
   Steps:
     - Create 'Dashboard' gcas for object.
     - Fill with values
     - Check if 'Dashboard' tab exist.
     - Navigate to 'Dashboard' tab.
     - Check only GCAs filled with right values displayed on the tab.
   """
   urls = ["https://gmail.by/", "https://www.google.com/",
           base_url, random_string(), "ftp://something.com/"]
   cads_rest_service = rest_service.CustomAttributeDefinitionsService()
   gca_defs = (cads_rest_service.create_dashboard_gcas(
       new_control_rest.type, count=len(urls)))
   control_rest_service = rest_service.ControlsService()
   control_rest_service.update_obj(
       obj=new_control_rest, custom_attributes=dict(
           zip([gca_def.id for gca_def in gca_defs], urls)))
   expected_dashboards_items = dict(zip(
       [gca_def.title.replace(aliases.DASHBOARD + "_", "")
        for gca_def in gca_defs], urls[:3]))
   controls_ui_service = webui_service.ControlsService(selenium)
   is_dashboard_tab_exist = (
       controls_ui_service.is_dashboard_tab_exist(new_control_rest))
   assert is_dashboard_tab_exist
   actual_dashboards_items = (
       controls_ui_service.get_items_from_dashboard_widget(new_control_rest))
   assert expected_dashboards_items == actual_dashboards_items
   cads_rest_service.delete_objs(gca_defs)
Ejemplo n.º 3
0
 def generate_string(cls, first_part):
   """Generate string in unicode format according object type and random data.
   """
   special_chars = string_utils.SPECIAL
   return unicode("{first_part}_{uuid}_{rand_str}".format(
       first_part=first_part, uuid=random_uuid(),
       rand_str=random_string(size=len(special_chars), chars=special_chars)))
Ejemplo n.º 4
0
 def _generate_title(cls, obj_type):
     """Generate title according object type."""
     special_chars = string_utils.SPECIAL
     return "{obj_type}_{rand_str}_{uuid}".format(
         obj_type=obj_type,
         uuid=uuid.uuid4(),
         rand_str=random_string(size=len(special_chars),
                                chars=special_chars))
Ejemplo n.º 5
0
 def test_dashboard_gca(self, new_control_rest, selenium, base_url):
     # pylint: disable=anomalous-backslash-in-string
     """Check Dashboard Tab is exist if 'Dashboard' GCA filled
 with right value. Possible values match to regexp r"^https?://[^\s]+$".
 Steps:
   - Create 'Dashboard' gcas for object.
   - Fill with values
   - Check if 'Dashboard' tab exist.
   - Navigate to 'Dashboard' tab.
   - Check only GCAs filled with right values displayed on the tab.
 """
     urls = [
         "https://gmail.by/", "https://www.google.com/", base_url,
         random_string(), "ftp://something.com/"
     ]
     cads_rest_service = rest_service.CustomAttributeDefinitionsService()
     gca_defs = (cads_rest_service.create_dashboard_gcas(
         new_control_rest.type, count=len(urls)))
     control_rest_service = rest_service.ControlsService()
     control_rest_service.update_obj(
         obj=new_control_rest,
         custom_attributes=dict(
             zip([gca_def.id for gca_def in gca_defs], urls)))
     expected_dashboards_items = dict(
         zip([
             gca_def.title.replace(aliases.DASHBOARD + "_", "")
             for gca_def in gca_defs
         ], urls[:3]))
     controls_ui_service = webui_service.ControlsService(selenium)
     is_dashboard_tab_exist = (
         controls_ui_service.is_dashboard_tab_exist(new_control_rest))
     assert is_dashboard_tab_exist
     actual_dashboards_items = (
         controls_ui_service.get_items_from_dashboard_widget(
             new_control_rest))
     assert expected_dashboards_items == actual_dashboards_items
     cads_rest_service.delete_objs(gca_defs)
Ejemplo n.º 6
0
 def _generate_title(cls, obj_type):
   """Generate title according object type and random data."""
   special_chars = string_utils.SPECIAL
   return "{obj_type}_{uuid}_{rand_str}".format(
       obj_type=obj_type, uuid=random_uuid(),
       rand_str=random_string(size=len(special_chars), chars=special_chars))
Ejemplo n.º 7
0
 def _generate_title(cls, ca_type):
     """Generate title according to CustomAttribute type."""
     special_chars = string_utils.SPECIAL
     return append_random_string("{}_{}_".format(
         ca_type, random_string(size=len(special_chars),
                                chars=special_chars)))