def test_export_of_snapshoted_control_from_src_objs_pages_via_tree_view( self, create_tmp_dir, create_audit_with_control_and_update_control, dynamic_objects, dynamic_relationships, selenium): """Check if snapshoted Control can be exported from (Audit's, Issue's, Assessment's) Info Page via mapped Controls's Tree View. Preconditions: - Execution and return of fixtures: - 'create_tmp_dir'; - 'create_audit_and_update_first_of_two_original_controls'. Test parameters: - 'dynamic_objects'; - 'dynamic_relationships'. """ audit_with_one_control = create_audit_with_control_and_update_control is_issue_flow = (isinstance(dynamic_objects, dict) and dynamic_objects.get("new_issue_rest") is not None) dynamic_objects = ((dynamic_objects["new_issue_rest"] if is_issue_flow else dynamic_objects) if dynamic_objects else audit_with_one_control["new_audit_rest"][0]) expected_control = audit_with_one_control["new_control_rest"][ 0].repr_ui() export_ui_service = webui_service.BaseWebUiService( driver=selenium, obj_name=objects.get_plural(expected_control.type), is_versions_widget=is_issue_flow) export_ui_service.export_objs_via_tree_view(src_obj=dynamic_objects) actual_controls = export_ui_service.get_list_objs_from_csv( path_to_export_dir=create_tmp_dir) # 'actual_controls': created_at, updated_at, # custom_attributes (GGRC-2344) (None) self.general_equal_assert([expected_control], actual_controls, *Representation.tree_view_attrs_to_exclude)
def test_export_of_snapshoted_control_from_audit_via_tree_view( self, create_tmp_dir, create_audit_with_control_and_update_control, selenium): """Check if snapshoted Control can be exported from Audit via Tree View. Preconditions: - Execution and return of fixture 'create_audit_and_update_first_of_two_original_controls'. Test parameters: None """ audit_with_one_control = create_audit_with_control_and_update_control audit = audit_with_one_control["new_audit_rest"][0] # due to 'actual_control.custom_attributes = {None: None}' expected_control = (audit_with_one_control["new_control_rest"] [0].repr_ui().update_attrs( custom_attributes={None: None})) export_service = webui_service.BaseWebUiService( selenium, objects.get_plural(expected_control.type)) export_service.export_objs_via_tree_view(src_obj=audit) actual_controls = export_service.get_list_objs_from_csv( path_to_export_dir=create_tmp_dir) actual_controls = [ actual_control.repr_ui() for actual_control in actual_controls ] assert [expected_control ] == actual_controls, (messages.ERR_MSG_FORMAT.format( [expected_control], actual_controls))
def test_export_of_snapshoted_control_from_src_objs_pages_via_tree_view( self, create_tmp_dir, create_audit_with_control_and_update_control, dynamic_object, dynamic_relationships, selenium): """Check if snapshoted Control can be exported from (Audit's, Issue's, Assessment's) Info Page via mapped Controls's Tree View. Preconditions: - Execution and return of fixtures: - 'create_tmp_dir'; - 'create_audit_and_update_first_of_two_original_controls'. Test parameters: - 'dynamic_object'; - 'dynamic_relationships'. """ audit_with_one_control = create_audit_with_control_and_update_control dynamic_object = (dynamic_object if dynamic_object else audit_with_one_control["new_audit_rest"][0]) # due to 'actual_control.custom_attributes = {None: None}' expected_control = (audit_with_one_control["new_control_rest"] [0].repr_ui().update_attrs( custom_attributes={None: None})) export_service = webui_service.BaseWebUiService( selenium, objects.get_plural(expected_control.type)) export_service.export_objs_via_tree_view(src_obj=dynamic_object) actual_controls = export_service.get_list_objs_from_csv( path_to_export_dir=create_tmp_dir) self.extended_assert([expected_control], actual_controls, "Issue in app GGRC-2750", "owners")
def test_cannot_unmap_disabled_obj(self, obj, mapped_obj, selenium): """Check that user cannot unmap Risk/Control from Scope Objects/Directives and new tab opens.""" webui_service.BaseWebUiService( objects.get_plural(obj.type)).open_info_panel_of_mapped_obj( mapped_obj, obj).three_bbs.select_unmap_in_new_frontend() _, new_tab = browsers.get_browser().windows() expected_url = mapped_obj.url + url.Widget.INFO assert new_tab.url == expected_url
def _get_ui_service(selenium, obj): """Get webui_service for object""" obj_type = objects.get_plural(obj.type) return webui_service.BaseWebUiService(obj_type, selenium)