コード例 #1
0
ファイル: admin_widget.py プロジェクト: egorhm/ggrc-core
 def add_custom_attribute(self, ca_obj):
   """Add custom attribute from custom attribute object given."""
   ca_item_content = self.expand_collapse_group(
       objects.get_normal_form(ca_obj.definition_type), expand=True)
   ca_item_content.add_new_custom_attribute(ca_obj)
   self.expand_collapse_group(
       objects.get_normal_form(ca_obj.definition_type), expand=False)
コード例 #2
0
 def add_custom_attribute(self, ca_obj):
   """Add custom attribute from custom attribute object given."""
   ca_item_content = self.expand_collapse_group(
       objects.get_normal_form(ca_obj.definition_type), expand=True)
   ca_item_content.add_new_custom_attribute(ca_obj)
   self.expand_collapse_group(
       objects.get_normal_form(ca_obj.definition_type), expand=False)
コード例 #3
0
 def get_custom_attributes_list(self, ca_group):
   """Collect custom attributes from expanded custom attribute group
   Tree View.
   """
   ca_item_content = self.expand_collapse_group(
       objects.get_normal_form(ca_group.definition_type), expand=True)
   return ca_item_content.get_ca_list_from_group()
コード例 #4
0
    def test_cannot_map_control_via_um_create_new_obj(self, control,
                                                      regulation,
                                                      dashboard_controls_tab,
                                                      selenium):
        """Tests that user cannot map control to scope objects/directives
    via unified mapper (create a new scope/directive object)."""
        expected_conditions = {
            "regulation_in_top_tabs": False,
            "new_tab_url": url.Urls().dashboard_info_tab
        }
        actual_conditions = copy.deepcopy(expected_conditions)

        dashboard_controls_tab.get_control(control).select_map_to_this_object()
        webui_facade.map_object_via_unified_mapper(
            selenium=selenium,
            obj_name=objects.CONTROLS,
            dest_objs_type=objects.get_singular(plural=objects.REGULATIONS,
                                                title=True),
            obj_to_map=regulation,
            proceed_in_new_tab=True)
        _, new_tab = browsers.get_browser().windows()
        actual_conditions['new_tab_url'] = new_tab.url
        actual_conditions['regulation_in_top_tabs'] = (objects.get_normal_form(
            objects.REGULATIONS) in webui_service.ControlsService(
                selenium).open_info_page_of_obj(control).top_tabs.tab_names)
        assert expected_conditions == actual_conditions
コード例 #5
0
 def test_asmts_and_issues_mapping_to_snapshotable_objs(
         self, create_audit_with_control_and_update_control, dynamic_object,
         selenium):
     """Check only snapshotable objs are available to map via UnifiedMapper and
 AddWidget button on Horizontal Nav Bar.
 Test parameters:
   "Checking assessment"
   "Checking issue"
 Steps:
   - Get list of available objs from HNB
   - Get list of available objs from UnifiedMapper
   - Compare their with constant of snapshotable objs
 """
     mapped_audit = create_audit_with_control_and_update_control[
         'new_audit_rest'][0]
     obj_ui_service = get_cls_webui_service(
         objects.get_plural(dynamic_object.type))(selenium)
     objs_types_from_mapper = (
         obj_ui_service.get_objs_available_to_map_via_mapper(
             src_obj=mapped_audit))
     objs_types_from_add_widget = (
         obj_ui_service.get_objs_available_to_map_via_add_widget(
             src_obj=dynamic_object))
     expected_objs_types = sorted(
         objects.get_normal_form(snap_obj)
         for snap_obj in objects.ALL_SNAPSHOTABLE_OBJS)
     assert (expected_objs_types == objs_types_from_mapper ==
             objs_types_from_add_widget)
コード例 #6
0
 def __init__(self, driver):
     super(Controls, self).__init__(driver)
     self.admin_text, self.admin_entered_text = (
         self.get_header_and_value_text_from_custom_scopes(
             self._elements.ADMIN.upper()))
     self.primary_contact_text, self.primary_contact_entered_text = (
         self.get_header_and_value_text_from_custom_scopes(
             self._elements.PRIMARY_CONTACT.upper()))
     self.code_text, self.code_entered_text = (
         self.get_header_and_value_text_from_custom_scopes(
             self._elements.CODE.upper()))
     self.cas_headers_text, self.cas_values_text = (
         self.get_headers_and_values_text_from_cas_scopes())
     # scope
     self.list_all_headers_text = [
         self._elements.CAS_HEADERS.upper(),
         self._elements.CAS_VALUES.upper(), self.title.text,
         self._elements.STATE.upper(), self.admin_text,
         self.primary_contact_text, self.code_text
     ]
     self.list_all_values_text = [
         self.cas_headers_text, self.cas_values_text,
         self.title_entered.text,
         objects.get_normal_form(self.state.text), self.admin_entered_text,
         self.primary_contact_entered_text, self.code_entered_text
     ]
コード例 #7
0
ファイル: admin_widget.py プロジェクト: egorhm/ggrc-core
 def get_custom_attributes_list(self, ca_group):
   """Collect custom attributes from expanded custom attribute group
   Tree View.
   """
   ca_item_content = self.expand_collapse_group(
       objects.get_normal_form(ca_group.definition_type), expand=True)
   return ca_item_content.get_ca_list_from_group()
コード例 #8
0
 def test_available_template_types(self, selenium):
   """Check available template types list is valid in dropdown on
   Download Template modal."""
   expected_list = sorted([objects.get_normal_form(obj_name)
                           for obj_name in list(objects.IMPORTABLE_OBJECTS) +
                           [download_template.SELECT_ALL_OPTION]])
   assert webui_facade.get_available_templates_list() == expected_list
コード例 #9
0
 def test_availability_mapping_of_objects_to_snapshotable_objs(
         self, create_audit_with_control_and_update_control,
         dynamic_objects, selenium):
     """Check availability mapping of objects to Control's snapshots via UI
 using Unified Mapper functionality and AddWidget button on Horizontal
 Nav Bar.
 Steps:
   - Get list of available objects from HNB
   - Get list of available objects from Unified Mapper
   - Compare their with constant of snapshotable objects
 """
     mapped_audit = create_audit_with_control_and_update_control[
         'new_audit_rest'][0]
     obj_ui_service = get_cls_webui_service(
         objects.get_plural(dynamic_objects.type))(selenium)
     objs_types_from_mapper = (
         obj_ui_service.get_objs_available_to_map_via_mapper(
             src_obj=mapped_audit))
     objs_types_from_add_widget = (
         obj_ui_service.get_objs_available_to_map_via_add_widget(
             src_obj=dynamic_objects))
     expected_objs_types = sorted(
         objects.get_normal_form(snap_obj)
         for snap_obj in objects.ALL_SNAPSHOTABLE_OBJS)
     assert (expected_objs_types == objs_types_from_mapper ==
             objs_types_from_add_widget)
コード例 #10
0
ファイル: test_snapshots.py プロジェクト: Smotko/ggrc-core
 def test_availability_mapping_of_objects_to_snapshotable_objs(
     self, create_audit_with_control_and_update_control, dynamic_objects,
     selenium
 ):
   """Check availability mapping of objects to Control's snapshots via UI
   using Unified Mapper functionality and AddWidget button on Horizontal
   Nav Bar.
   Steps:
     - Get list of available objects from HNB
     - Get list of available objects from Unified Mapper
     - Compare their with constant of snapshotable objects
   """
   mapped_audit = create_audit_with_control_and_update_control[
       'new_audit_rest'][0]
   obj_ui_service = get_cls_webui_service(
       objects.get_plural(dynamic_objects.type))(selenium)
   objs_types_from_mapper = (
       obj_ui_service.get_objs_available_to_map_via_mapper(
           src_obj=mapped_audit))
   objs_types_from_add_widget = (
       obj_ui_service.get_objs_available_to_map_via_add_widget(
           src_obj=dynamic_objects))
   expected_objs_types = sorted(
       objects.get_normal_form(snap_obj)
       for snap_obj in objects.ALL_SNAPSHOTABLE_OBJS)
   assert (expected_objs_types == objs_types_from_mapper ==
           objs_types_from_add_widget)
コード例 #11
0
ファイル: info_widget.py プロジェクト: driima/ggrc-core
 def get_info_widget_obj_scope(self):
     """Get an Assessment object's text scope (headers' (real and synthetic)
 and values' txt) from Info Widget navigating through the Assessment's tabs.
 """
     self.workflow_container.switch_to_tab(
         element.AssessmentTabContainer.OTHER_ATTRS_TAB)
     cas_text = self.get_headers_and_values_dict_from_cas_scopes()
     code_section = base.Label(self._driver, self._locators.CODE_CSS)
     code_text = code_section.element.find_element(
         *self._locators.CODE_HEADER_CSS).text
     code_entered_text = code_section.element.find_element(
         *self._locators.CODE_VALUE_CSS).text
     # todo: implement separate entities' model for asmts' lcas and gcas
     cas_text.update(self.lcas_text)
     self.list_all_headers_text = [
         self._elements.CAS.upper(), self._elements.TITLE,
         self._elements.STATE.upper(),
         self._elements.VERIFIED.upper(), self.creators_text,
         self.assignees_text, self.verifiers_text,
         self._elements.MAPPED_OBJECTS.upper(), code_text,
         self.comments.header_lbl.text
     ]
     self.list_all_values_text = [
         cas_text,
         self.title_entered().text,
         objects.get_normal_form(self.state().text), self.verified,
         self.creators_entered_text, self.assignees_entered_text,
         self.verifiers_entered_text, self.mapped_objects_titles_text,
         code_entered_text, self.comments_scopes
     ]
     return dict(zip(self.list_all_headers_text, self.list_all_values_text))
コード例 #12
0
ファイル: info_widget.py プロジェクト: zidarsk8/ggrc-core
 def __init__(self, driver):
   super(Assessments, self).__init__(driver)
   # toggles
   self.people_section = base.Toggle(
       self._driver, self._locators.BUTTON_PEOPLE_TOGGLE, locator.Common.DOWN)
   self.code_section = base.Toggle(
       self._driver, self._locators.BUTTON_CODE_TOGGLE, locator.Common.DOWN)
   # mapped objects
   self.mapped_objects_titles_and_descriptions = self._driver.find_elements(
       *self._locators.MAPPED_OBJECTS_TITLES_AND_DESCRIPTIONS)
   if self.mapped_objects_titles_and_descriptions:
     self.mapped_objects_titles_text = [
         mapped_scope.text.splitlines()[0]
         for mapped_scope in self.mapped_objects_titles_and_descriptions if
         len(mapped_scope.text.splitlines()) >= 2]
     self.mapped_objects_descriptions_text = [
         mapped_scope.text.splitlines()[1]
         for mapped_scope in self.mapped_objects_titles_and_descriptions if
         len(mapped_scope.text.splitlines()) >= 2]
   self.cas_text = self.get_headers_and_values_dict_from_cas_scopes()
   # people section
   self.people_section.toggle()
   self.creators_text, self.creators_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.CREATORS_.upper(),
           self._locators.PEOPLE_HEADERS_AND_VALUES))
   self.assignees_text, self.assignees_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.ASSIGNEES_.upper(),
           self._locators.PEOPLE_HEADERS_AND_VALUES))
   self.verifiers_text, self.verifiers_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.ASSIGNEES_.upper(),
           self._locators.PEOPLE_HEADERS_AND_VALUES))
   self.people_section.toggle(False)
   # code section
   self.code_section.toggle()
   self.code_and_code_entered = self._driver.find_elements(
       *self._locators.CODE_HEADER_AND_VALUE)
   if self.code_and_code_entered:
     self.code_text, self.code_entered_text = [
         [mapped_scope.text.split()[0], mapped_scope.text.split()[1]] for
         mapped_scope in self.code_and_code_entered if
         len(mapped_scope.text.split()) >= 2][0]
   self.code_section.toggle(False)
   # scope
   self.list_all_headers_text = [
       self._elements.CAS.upper(), self.title().text,
       self._elements.STATE.upper(), self._elements.VERIFIED.upper(),
       self._elements.CREATORS.upper(), self._elements.ASSIGNEES.upper(),
       self._elements.VERIFIERS.upper(),
       self._elements.MAPPED_OBJECTS.upper(), self.code_text]
   self.list_all_values_text = [
       self.cas_text, self.title_entered().text,
       objects.get_normal_form(self.state().text),
       self.state().text.upper() in
       element.AssessmentStates.COMPLETED.upper(), self.creators_entered_text,
       self.assignees_entered_text, self.verifiers_entered_text,
       self.mapped_objects_titles_text, self.code_entered_text]
コード例 #13
0
ファイル: element.py プロジェクト: jeis2497052/ggrc-core
class CommonControl(Common):
  """Common elements' labels and properties for Controls objects."""
  CONTROL = objects.get_normal_form(objects.get_singular(objects.CONTROLS))
  STATE = Base.STATE
  ADMIN = roles.ADMIN
  PRIMARY_CONTACTS = roles.PRIMARY_CONTACTS
  CREATORS = "Creators"
  MAPPED_OBJECTS = "Mapped Objects"
コード例 #14
0
ファイル: element.py プロジェクト: jeis2497052/ggrc-core
class CommonObjective(Common):
  """Common elements' labels and properties for Objective objects."""
  OBJECTIVE = objects.get_normal_form(objects.get_singular(objects.OBJECTIVES))
  STATE = Base.STATE
  ADMIN = roles.ADMIN
  PRIMARY_CONTACTS = roles.PRIMARY_CONTACTS
  CREATORS = "Creators"
  MAPPED_OBJECTS = "Mapped Objects"
コード例 #15
0
class CommonAssessment(Common):
  """Common elements' labels and properties for Assessments objects."""
  ASMT = objects.get_normal_form(objects.get_singular(objects.ASSESSMENTS))
  STATE = Base.STATE
  CREATORS_ = "Creator(s) *"
  CREATORS = TransformationSetVisibleFields.CREATORS
  MAPPED_OBJECTS = TransformationSetVisibleFields.MAPPED_OBJECTS
  VERIFIED = TransformationSetVisibleFields.VERIFIED
コード例 #16
0
class CommonControl(Common):
    """Common elements' labels and properties for Controls objects."""
    CONTROL = objects.get_normal_form(objects.get_singular(objects.CONTROLS))
    STATE = Base.STATE
    ADMIN = roles.ADMIN
    PRIMARY_CONTACTS = roles.PRIMARY_CONTACTS
    CREATORS = roles.CREATORS
    MAPPED_OBJECTS = TransformationSetVisibleFields.MAPPED_OBJECTS
コード例 #17
0
 def _normalize_ca_definition_type(ca_object):
     """
 Get ca_group title from the selected object for further using in UI.
 For manipulations with object via REST, definition type should be
 interpreted as objects.get_singular().get_object_name_form().
 """
     ca_object.definition_type = objects.get_normal_form(
         ca_object.definition_type)
     return ca_object
コード例 #18
0
ファイル: admin_widget.py プロジェクト: weizai118/ggrc-core
  def get_custom_attributes_list(self, obj_type):
    """Collect custom attributes from expanded object type Tree View.

    Returns:
      list of Custom Attribute objects.
    """
    ca_item_content = self.expand_collapse_group(
        objects.get_normal_form(obj_type), expand=True)
    return ca_item_content.get_ca_list_from_group()
コード例 #19
0
 def _normalize_ca_definition_type(cls, ca_object):
     """Transform definition type to title form.
 Title from used for UI operations.
 For REST operations definition type should be interpreted as
 objects.get_singular().get_object_name_form().
 """
     ca_object.definition_type = objects.get_normal_form(
         ca_object.definition_type)
     return ca_object
コード例 #20
0
class CommonProgram(Common):
  """Common elements' labels and properties for Programs objects."""
  # pylint: disable=too-many-instance-attributes
  PROGRAM = objects.get_normal_form(objects.get_singular(objects.PROGRAMS))
  TITLE = Common.TITLE
  MANAGER = "Manager"
  NOTES = "Notes"
  EFFECTIVE_DATE = Base.EFFECTIVE_DATE
  STATE = Base.STATE
コード例 #21
0
  def test_availability_mapping_of_objects_via_mapper_and_add_widget(
      self, create_audit_with_control_and_update_control, dynamic_objects,
      dynamic_relationships, selenium
  ):
    """Check availability mapping of objects to Assessment and Issue via UI
    using Unified Mapper functionality and AddWidget button on Horizontal
    Nav Bar.

    Steps:
      - Get list of available objects from Unified Mapper;
      - Get list of available objects from HNB;
      - Compare their with constant of expected objects accordingly.
    """
    expected_objs_names_from_mapper = (
        objects.ALL_SNAPSHOTABLE_OBJS + (objects.ISSUES, ))
    if dynamic_objects.type == objects.get_obj_type(objects.ISSUES):
      expected_objs_names_from_mapper = expected_objs_names_from_mapper + (
          objects.PROGRAMS, objects.PROJECTS, objects.DOCUMENTS)
    expected_objs_names_from_add_widget = expected_objs_names_from_mapper
    expected_objs_types_from_mapper = sorted(
        objects.get_normal_form(obj_name)
        for obj_name in expected_objs_names_from_mapper)
    expected_objs_types_from_add_widget = sorted(
        objects.get_normal_form(obj_name)
        for obj_name in expected_objs_names_from_add_widget)
    mapped_audit = create_audit_with_control_and_update_control[
        "new_audit_rest"][0]
    obj_ui_service = get_cls_webui_service(
        objects.get_plural(dynamic_objects.type))(selenium)
    actual_objs_types_from_mapper = (
        obj_ui_service.get_objs_available_to_map_via_mapper(
            src_obj=mapped_audit))
    actual_objs_types_from_add_widget = (
        obj_ui_service.get_objs_available_to_map_via_add_widget(
            src_obj=dynamic_objects))
    assert (expected_objs_types_from_mapper ==
            actual_objs_types_from_mapper), (
        messages.AssertionMessages.format_err_msg_equal(
            expected_objs_types_from_mapper, actual_objs_types_from_mapper))
    assert (expected_objs_types_from_add_widget ==
            actual_objs_types_from_add_widget), (
        messages.AssertionMessages.format_err_msg_equal(
            expected_objs_types_from_add_widget,
            actual_objs_types_from_add_widget))
コード例 #22
0
ファイル: test_snapshots.py プロジェクト: egorhm/ggrc-core
  def test_availability_mapping_of_objects_via_mapper_and_add_widget(
      self, create_audit_with_control_and_update_control, dynamic_objects,
      dynamic_relationships, selenium
  ):
    """Check availability mapping of objects to Assessment and Issue via UI
    using Unified Mapper functionality and AddWidget button on Horizontal
    Nav Bar.

    Steps:
      - Get list of available objects from Unified Mapper;
      - Get list of available objects from HNB;
      - Compare their with constant of expected objects accordingly.
    """
    expected_objs_names_from_mapper = (
        objects.ALL_SNAPSHOTABLE_OBJS + (objects.ISSUES, ))
    if dynamic_objects.type == objects.get_obj_type(objects.ISSUES):
      expected_objs_names_from_mapper = expected_objs_names_from_mapper + (
          objects.PROGRAMS, objects.PROJECTS, objects.DOCUMENTS)
    expected_objs_names_from_add_widget = expected_objs_names_from_mapper
    expected_objs_types_from_mapper = sorted(
        objects.get_normal_form(obj_name)
        for obj_name in expected_objs_names_from_mapper)
    expected_objs_types_from_add_widget = sorted(
        objects.get_normal_form(obj_name)
        for obj_name in expected_objs_names_from_add_widget)
    mapped_audit = create_audit_with_control_and_update_control[
        "new_audit_rest"][0]
    obj_ui_service = get_cls_webui_service(
        objects.get_plural(dynamic_objects.type))(selenium)
    actual_objs_types_from_mapper = (
        obj_ui_service.get_objs_available_to_map_via_mapper(
            src_obj=mapped_audit))
    actual_objs_types_from_add_widget = (
        obj_ui_service.get_objs_available_to_map_via_add_widget(
            src_obj=dynamic_objects))
    assert (expected_objs_types_from_mapper ==
            actual_objs_types_from_mapper), (
        messages.AssertionMessages.format_err_msg_equal(
            expected_objs_types_from_mapper, actual_objs_types_from_mapper))
    assert (expected_objs_types_from_add_widget ==
            actual_objs_types_from_add_widget), (
        messages.AssertionMessages.format_err_msg_equal(
            expected_objs_types_from_add_widget,
            actual_objs_types_from_add_widget))
コード例 #23
0
 def test_check_ca_groups(self, admin_dashboard):
   """Check that full list of Custom Attributes groups is displayed
   on Admin Dashboard panel.
   """
   ca_tab = admin_dashboard.select_custom_attributes()
   expected_ca_groups_set = set(
       [objects.get_normal_form(item) for item in objects.ALL_CA_OBJS])
   actual_ca_groups_set = set(
       [item.text for item in ca_tab.get_items_list()])
   assert expected_ca_groups_set == actual_ca_groups_set
コード例 #24
0
 def add_and_map_obj_widget(self, obj):
     """Adds widget of selected type and
 click `Create and map new object` link and
 returns modal object for selected object type."""
     widget_bar.Programs().add_widget()
     dashboard.CreateObjectDropdown().click_item_by_text(
         text=objects.get_normal_form(obj))
     obj_modal = unified_mapper.CommonUnifiedMapperModal(
         self.driver, obj).click_create_and_map_obj()
     return obj_modal
コード例 #25
0
ファイル: element.py プロジェクト: jeis2497052/ggrc-core
class CommonAssessment(Common):
  """Common elements' labels and properties for Assessments objects."""
  ASMT = objects.get_normal_form(objects.get_singular(objects.ASSESSMENTS))
  STATE = Base.STATE
  CREATORS = "Creators"
  COMMENTS = "Comments"
  ASSIGNEES = "Assignees"
  VERIFIERS = "Verifiers"
  MAPPED_OBJECTS = TransformationSetVisibleFields.MAPPED_OBJECTS
  VERIFIED = TransformationSetVisibleFields.VERIFIED
コード例 #26
0
 def _normalize_list_scopes_from_csv(self, list_obj_scopes):
   """Returns objects scopes list from CSV with properly formatted keys."""
   list_scopes = []
   for item in list_obj_scopes:
     list_scopes.append({objects.get_normal_form(k).replace("*", ""): v
                         for k, v in item.iteritems()})
   if self.obj_name == objects.CONTROLS:
     for scope in list_scopes:
       scope["REVIEW_STATUS_DISPLAY_NAME"] = scope["Review Status"]
   return list_scopes
コード例 #27
0
 def test_check_ca_groups(self, admin_dashboard):
   """Check that full list of Custom Attributes groups is displayed
   on Admin Dashboard panel.
   """
   ca_tab = admin_dashboard.select_custom_attributes()
   expected_ca_groups_set = set(
       [objects.get_normal_form(item) for item in objects.ALL_CA_OBJS])
   actual_ca_groups_set = set(
       [item.text for item in ca_tab.get_items_list()])
   assert expected_ca_groups_set == actual_ca_groups_set
コード例 #28
0
 def __init__(self, driver):
   super(Assessments, self).__init__(driver)
   # toggles
   self.code_section = base.Toggle(
       self._driver, self._locators.BUTTON_CODE_TOGGLE, locator.Common.DOWN)
   # mapped objects
   self.mapped_objects_titles_and_descriptions = self._driver.find_elements(
       *self._locators.MAPPED_OBJECTS_TITLES_AND_DESCRIPTIONS)
   if self.mapped_objects_titles_and_descriptions:
     self.mapped_objects_titles_text = [
         mapped_scope.text.splitlines()[0]
         for mapped_scope in self.mapped_objects_titles_and_descriptions if
         len(mapped_scope.text.splitlines()) >= 2]
     self.mapped_objects_descriptions_text = [
         mapped_scope.text.splitlines()[1]
         for mapped_scope in self.mapped_objects_titles_and_descriptions if
         len(mapped_scope.text.splitlines()) >= 2]
   self.cas_text = self.get_headers_and_values_dict_from_cas_scopes()
   # people section
   self.creators_text, self.creators_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.CREATORS_.upper(),
           self._locators.PEOPLE_HEADERS_AND_VALUES))
   self.assignees_text, self.assignees_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.ASSIGNEES_.upper(),
           self._locators.PEOPLE_HEADERS_AND_VALUES))
   self.verifiers_text, self.verifiers_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.ASSIGNEES_.upper(),
           self._locators.PEOPLE_HEADERS_AND_VALUES))
   # code section
   self.code_section.toggle()
   self.code_and_code_entered = self._driver.find_elements(
       *self._locators.CODE_HEADER_AND_VALUE)
   if self.code_and_code_entered:
     self.code_text, self.code_entered_text = [
         [mapped_scope.text.split()[0], mapped_scope.text.split()[1]] for
         mapped_scope in self.code_and_code_entered if
         len(mapped_scope.text.split()) >= 2][0]
   self.code_section.toggle(False)
   # scope
   self.list_all_headers_text = [
       self._elements.CAS.upper(), self.title().text,
       self._elements.STATE.upper(), self._elements.VERIFIED.upper(),
       self._elements.CREATORS.upper(), self._elements.ASSIGNEES.upper(),
       self._elements.VERIFIERS.upper(),
       self._elements.MAPPED_OBJECTS.upper(), self.code_text]
   self.list_all_values_text = [
       self.cas_text, self.title_entered().text,
       objects.get_normal_form(self.state().text),
       self.state().text.upper() in
       element.AssessmentStates.COMPLETED.upper(), self.creators_entered_text,
       self.assignees_entered_text, self.verifiers_entered_text,
       self.mapped_objects_titles_text, self.code_entered_text]
コード例 #29
0
 def test_check_ca_groups(self, admin_dashboard):
     """Check that full list of Custom Attributes groups is displayed
 on Admin Dashboard panel.
 """
     ca_widget = admin_dashboard.select_custom_attributes()
     act_ca_groups_set = set(
         [item.text for item in ca_widget.get_items_list()])
     exp_ca_groups_set = set(
         [objects.get_normal_form(item) for item in objects.all_objects])
     assert exp_ca_groups_set == act_ca_groups_set, self.err_msg_format.format(
         exp_ca_groups_set, act_ca_groups_set)
コード例 #30
0
 def test_check_ca_groups(self, admin_dashboard):
   """Check that full list of Custom Attributes groups is displayed
   on Admin Dashboard panel.
   """
   ca_widget = admin_dashboard.select_custom_attributes()
   act_ca_groups_set = set([item.text for item in ca_widget.get_items_list()])
   exp_ca_groups_set = set([objects.get_normal_form(item) for item in
                            objects.ALL_CA_OBJECTS])
   assert exp_ca_groups_set == act_ca_groups_set, (
       messages.ERR_MSG_FORMAT.format(
           exp_ca_groups_set, act_ca_groups_set))
コード例 #31
0
 def test_add_global_ca(self, admin_dashboard, ca_type):
   """Create different types of Custom Attribute on Admin Dashboard."""
   def_type = objects.get_normal_form(random.choice(objects.EDITABLE_CA_OBJS))
   expected_ca = entities_factory.CustomAttributeDefinitionsFactory().create(
       attribute_type=ca_type, definition_type=def_type)
   ca_tab = admin_dashboard.select_custom_attributes()
   ca_tab.add_custom_attribute(ca_obj=expected_ca)
   actual_cas = ca_tab.get_custom_attributes_list(ca_group=expected_ca)
   # 'actual_ca': multi_choice_options (None)
   self.general_contain_assert(expected_ca, actual_cas,
                               "multi_choice_options")
コード例 #32
0
 def test_check_ca_groups(self, admin_dashboard):
   """Check that full list of Custom Attributes groups is displayed
   on Admin Dashboard panel.
   """
   ca_widget = admin_dashboard.select_custom_attributes()
   act_ca_groups_set = set([item.text for item in ca_widget.get_items_list()])
   exp_ca_groups_set = set([objects.get_normal_form(item) for item in
                            objects.ALL_CA_OBJS])
   assert exp_ca_groups_set == act_ca_groups_set, (
       messages.ERR_MSG_FORMAT.format(
           exp_ca_groups_set, act_ca_groups_set))
コード例 #33
0
  def _normalize_ca_definition_type(cls, ca_object):
    """Transform definition type to title form.

    Title from used for UI operations.
    For REST operations definition type should be interpreted as
    objects.get_singular().get_object_name_form().
    """
    ca_object.definition_type = objects.get_normal_form(
        ca_object.definition_type
    )
    return ca_object
コード例 #34
0
 def test_add_global_ca(self, admin_dashboard, ca_type):
   """Create different types of Custom Attribute on Admin Dashboard."""
   def_type = objects.get_normal_form(random.choice(objects.ALL_CA_OBJS))
   expected_ca = entities_factory.CustomAttributeDefinitionsFactory().create(
       attribute_type=ca_type, definition_type=def_type)
   ca_tab = admin_dashboard.select_custom_attributes()
   ca_tab.add_custom_attribute(ca_obj=expected_ca)
   actual_cas = ca_tab.get_custom_attributes_list(ca_group=expected_ca)
   # 'actual_ca': multi_choice_options (None)
   self.general_contain_assert(expected_ca, actual_cas,
                               "multi_choice_options")
コード例 #35
0
class CommonAssessment(Common):
    """Common elements' labels and properties for Assessments objects."""
    ASMT = objects.get_normal_form(objects.get_singular(objects.ASSESSMENTS))
    STATE = Base.STATE
    CREATORS = roles.CREATORS
    COMMENTS = "Comments"
    ASSIGNEES = roles.ASSIGNEES
    VERIFIERS = roles.VERIFIERS
    MAPPED_OBJECTS = TransformationSetVisibleFields.MAPPED_OBJECTS
    ASMT_TYPE = "Assessment Type"
    VERIFIED = TransformationSetVisibleFields.VERIFIED
コード例 #36
0
    def edit_custom_attribute(self, ca_to_edit, new_ca):
        """Open Custom Attribute Definition Modal window for ca_to_edit (found
    by title) and submit form with ca_to_edit data.

    Returns:
      edited CA from ui.
    """
        definition_type = objects.get_normal_form(
            objects.get_plural(ca_to_edit.definition_type))
        self.ca_widget.open_edit_modal(definition_type,
                                       ca_to_edit.title).submit_obj(new_ca)
        return self.get_custom_attribute(definition_type, new_ca.title)
コード例 #37
0
 def test_custom_roles_widget(self, admin_dashboard):
   """Check count and content of roles scopes."""
   expected_set = set(
       [objects.get_normal_form(item) for
        item in objects.ALL_OBJS_W_CUSTOM_ROLES]
   )
   actual_set = \
       admin_dashboard.select_custom_roles().get_objects_text_as_set()
   assert admin_dashboard.tab_custom_roles.member_count == len(expected_set)
   assert expected_set == actual_set, (
       messages.AssertionMessages.
       format_err_msg_equal(expected_set, actual_set))
コード例 #38
0
 def test_add_global_ca(self, selenium, ca_type):
   """Create different types of Custom Attribute on Admin Dashboard."""
   def_type = objects.get_normal_form(random.choice(objects.EDITABLE_CA_OBJS))
   expected_ca = entities_factory.CustomAttributeDefinitionsFactory().create(
       attribute_type=ca_type, definition_type=def_type)
   ca_admin_service = admin_webui_service.CustomAttributeWebUiService(
       selenium)
   ca_admin_service.create_custom_attribute(new_ca=expected_ca)
   actual_cas = ca_admin_service.ca_widget.get_custom_attributes_list(
       obj_type=expected_ca.definition_type)
   self.general_contain_assert(expected_ca, actual_cas,
                               "multi_choice_options")
コード例 #39
0
 def test_custom_roles_widget(self, admin_dashboard):
   """Check count and content of roles scopes."""
   expected_set = set(
       [objects.get_normal_form(item) for
        item in objects.ALL_OBJS_W_CUSTOM_ROLES]
   )
   actual_set = \
       admin_dashboard.select_custom_roles().get_objects_text_as_set()
   assert admin_dashboard.tab_custom_roles.member_count == len(expected_set)
   assert expected_set == actual_set, (
       messages.AssertionMessages.
       format_err_msg_equal(expected_set, actual_set))
コード例 #40
0
ファイル: info_widget.py プロジェクト: sskhatri/ggrc-core
 def __init__(self, driver):
   super(Assessments, self).__init__(driver)
   self.code_section = base.Label(
       self._driver, self._locators.CODE_CSS)
   # mapped objects
   self.mapped_objects_titles_and_descriptions = self._driver.find_elements(
       *self._locators.MAPPED_OBJECTS_TITLES_AND_DESCRIPTIONS)
   self.mapped_objects_titles_text = [
       mapped_el.find_element(*self._locators.MAPPED_OBJECT_TITLE).text
       for mapped_el in self.mapped_objects_titles_and_descriptions]
   self.mapped_objects_descriptions_text = [
       mapped_el.find_element(*self._locators.MAPPED_OBJECT_DESCRIPTION).text
       for mapped_el in self.mapped_objects_titles_and_descriptions]
   self.cas_text = self.get_headers_and_values_dict_from_cas_scopes()
   # people section
   self.creators_text, self.creators_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.CREATORS_.upper(),
           self._locators.PEOPLE_HEADERS_AND_VALUES))
   self.assignees_text, self.assignees_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.ASSIGNEES_.upper(),
           self._locators.PEOPLE_HEADERS_AND_VALUES))
   self.verifiers_text, self.verifiers_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.VERIFIERS_.upper(),
           self._locators.PEOPLE_HEADERS_AND_VALUES))
   # code section
   self.code_text = (
       self.code_section.element.find_element(
           *self._locators.CODE_HEADER_CSS).text)
   self.code_entered_text = (
       self.code_section.element.find_element(
           *self._locators.CODE_VALUE_CSS).text)
   # comments section
   self.comments = base.CommentsPanel(
       self._driver, self._locators.COMMENTS_CSS)
   # scope
   self.list_all_headers_text = [
       self._elements.CAS.upper(), self._elements.TITLE,
       self._elements.STATE.upper(),
       self._elements.VERIFIED.upper(),
       self.creators_text, self.assignees_text,
       self.verifiers_text, self._elements.MAPPED_OBJECTS.upper(),
       self.code_text, self.comments.header_lbl.text]
   self.list_all_values_text = [
       self.cas_text, self.title_entered().text,
       objects.get_normal_form(self.state().text),
       self.state().text.upper() in
       element.AssessmentStates.COMPLETED.upper(),
       self.creators_entered_text, self.assignees_entered_text,
       self.verifiers_entered_text, self.mapped_objects_titles_text,
       self.code_entered_text, self.comments.scopes]
コード例 #41
0
ファイル: info_widget.py プロジェクト: zidarsk8/ggrc-core
 def __init__(self, driver):
   super(Audits, self).__init__(driver)
   self.audit_lead_text, self.audit_lead_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.AUDIT_LEAD.upper()))
   self.code_text, self.code_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.CODE.upper()))
   self.cas_text = self.get_headers_and_values_dict_from_cas_scopes()
   # all obj scopes
   self.list_all_headers_text = [
       self._elements.CAS.upper(), self.title().text,
       self._elements.STATUS.upper(), self.audit_lead_text, self.code_text]
   self.list_all_values_text = [
       self.cas_text, self.title_entered().text,
       objects.get_normal_form(self.state().text),
       self.audit_lead_entered_text, self.code_entered_text]
コード例 #42
0
 def generate(cls, objs_under_asmt_tmpl, audit):
   """Generate Assessment object according to:
   objects' under Assessment Template titles from list objects
   "objs_under_asmt_tmpl", audit's title from "audit", the total number of
   objects under Assessment Template.
   """
   # pylint: disable=too-many-locals
   from lib.service.rest_service import ObjectsInfoService
   actual_count_all_asmts = ObjectsInfoService().get_total_count(
       obj_name=objects.get_normal_form(cls._obj_asmt)
   )
   return [
       cls.create(
           title=obj_under_asmt_tmpl.title + " assessment for " + audit.title,
           code=(cls._obj_asmt.upper() + "-" + str(asmt_number)),
           audit=audit.title) for asmt_number, obj_under_asmt_tmpl in
       enumerate(objs_under_asmt_tmpl, start=actual_count_all_asmts + 1)]
コード例 #43
0
ファイル: info_widget.py プロジェクト: zidarsk8/ggrc-core
 def __init__(self, driver):
   super(Controls, self).__init__(driver)
   self.admin_text, self.admin_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.ADMIN.upper()))
   self.primary_contact_text, self.primary_contact_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.PRIMARY_CONTACT.upper()))
   self.code_text, self.code_entered_text = (
       self.get_header_and_value_text_from_custom_scopes(
           self._elements.CODE.upper()))
   self.cas_text = self.get_headers_and_values_dict_from_cas_scopes()
   # scope
   self.list_all_headers_text = [
       self._elements.CAS.upper(), self.title().text,
       self._elements.STATE.upper(), self.admin_text,
       self.primary_contact_text, self.code_text]
   self.list_all_values_text = [
       self.cas_text, self.title_entered().text,
       objects.get_normal_form(self.state().text), self.admin_entered_text,
       self.primary_contact_entered_text, self.code_entered_text]
コード例 #44
0
ファイル: info_widget.py プロジェクト: egorhm/ggrc-core
 def get_state_txt(self):
   """Get object's state text from Info Widget."""
   return objects.get_normal_form(
       base.Label(self.info_widget_elem, self._locators.STATE).text)