def test_update_snapshotable_ver_of_control(self, new_control_rest, new_program_rest, map_program_to_control_rest, new_audit_rest, update_control_rest, selenium): """Check via UI that Audit contains the snapshotable Control that equal to updated Control under Program after updated the original Control via REST API and updated snapshotable Control to latest version via UI. Preconditions: - Program, Control created via REST API. - Control mapped to Program via REST API. - Audit created under Program via REST API. - Original Control updated via REST API. """ audit, _ = new_audit_rest expected_control = update_control_rest ControlsService(selenium).update_ver_via_info_panel( source_obj=audit, control_obj=new_control_rest) actual_controls_tab_count = ( ControlsService(selenium).get_count_from_tab(source_obj=audit)) assert len([expected_control]) == actual_controls_tab_count actual_controls = (ControlsService(selenium).get_objs_from_tree_view( source_obj=audit)) assert [expected_control ] == actual_controls, (messages.ERR_MSG_FORMAT.format( [expected_control], actual_controls))
def assert_can_edit_control(selenium, cntrl, can_edit): """Assert that current user cannot edit control via UI.""" info_page = ControlsService(selenium).open_info_page_of_obj(cntrl) els_shown_for_editor = info_page.els_shown_for_editor() exp_list = [can_edit] * (len(els_shown_for_editor)) exp_list[0] = True # Add comment btn exists on all control pages assert [item.exists for item in els_shown_for_editor] == exp_list if info_page.three_bbs.exists: assert info_page.three_bbs.edit_option.exists is False
def assert_can_edit_control(selenium, cntrl, can_edit): """Assert that current user cannot edit control via UI.""" info_page = ControlsService(selenium).open_info_page_of_obj(cntrl) els_shown_for_editor = info_page.els_shown_for_editor() exp_list = [can_edit] * (len(els_shown_for_editor)) # Add comment btn exists on all control pages exp_list[0] = True # Request review button doesn't exist on all control pages exp_list[1] = False # Edit button doesn't exist on all control pages exp_list[2] = False assert [item.exists for item in els_shown_for_editor] == exp_list if info_page.three_bbs.exists: assert info_page.three_bbs.edit_option.exists is False
def assert_cannot_delete_control(selenium, cntrl): """Assert that current user cannot delete control via UI.""" cntrl_info_page = ControlsService(selenium).open_info_page_of_obj(cntrl) if cntrl_info_page.three_bbs.exists: assert cntrl_info_page.three_bbs.delete_option.exists is False