Пример #1
0
 def test_dashboard_gca(self, new_control_rest, selenium):
   # 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/",
           environment.app_url, StringMethods.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)
Пример #2
0
 def create_audit_and_update_first_of_two_original_controls(
         self, create_audit_and_update_original_control):
     """Create Audit with snapshotable Control and update original Control under
 Program via REST API. After that create second Control and map it to
 Program via REST API.
 Preconditions:
 - Execution and return of fixture
   'create_audit_and_update_original_control'.
 - Second Control created via REST API.
 - Second Control mapped to Program via REST API.
 """
     audit_with_one_control = create_audit_and_update_original_control
     second_control = rest_service.ControlsService().create_objs(count=1)[0]
     rest_service.ObjectsOwnersService().assign_owner_to_objs(
         objs=second_control)
     rest_service.RelationshipsService().map_objs(
         src_obj=audit_with_one_control["program"],
         dest_objs=second_control)
     return {
         "audit": create_audit_and_update_original_control["audit"],
         "program": audit_with_one_control["program"],
         "control": audit_with_one_control["control"],
         "updated_control": audit_with_one_control["updated_control"],
         "second_control": second_control
     }
Пример #3
0
def create_audit_with_control_and_delete_control(
    program, control_mapped_to_program, audit
):
  """Create Program and Control, map Control to Program, create Audit
  under Program, delete Control via REST API and return dictionary of executed
  fixtures.
  """
  return {"program": program,
          "control": copy.deepcopy(control_mapped_to_program),
          "audit": audit,
          "deleted_control": rest_service.ControlsService().delete_objs(
              control_mapped_to_program)}
Пример #4
0
def create_control(program=None):
    """Create a control (optionally map to a `program`)"""
    control = rest_service.ControlsService().create_objs(count=1)[0]
    if program:
        map_objs(program, control)
    return control