def edit_next_step(user_content, ns_uuid): r1 = None postURL = settings.ICE_EM_URL + '/v1/engmgr/nextsteps/' + ns_uuid + \ '/engagement/' + user_content['engagement_uuid'] + '/modify/' logger.debug("Put next step URL: " + postURL) headers = dict() # Create header for post request. headers['Content-type'] = 'application/json' headers['Authorization'] = user_content['session_token'] data = dict() # Create JSON data for post request. data['files'] = [] data['assigneesUuids'] = [user_content['uuid']] data['duedate'] = str(datetime.date.today()) data['description'] = "API edit next step test " + \ Helper.rand_string('randomString') try: r1 = requests.put(postURL, json=data, headers=headers, verify=False) Helper.internal_assert_boolean(r1.status_code, 202) logger.debug("Next step was edited successfully!") except BaseException: if r1 is None: logger.error("Failed to edit next step uuid: " + ns_uuid) else: logger.error("Failed to edit next step uuid: " + ns_uuid + ", see response >>> %s %s" % (r1.status_code, r1.reason)) raise
def create_faq(): title = "title_FAQ" + Helper.rand_string("randomString") description = "description_FAQ_" + Helper.rand_string("randomString") DBCMS.delete_old_tips_of_the_day() postId = DBCMS.insert_cms_new_post(title, description, "FAQ") assertTrue(len(postId) > 0 and not None) return title, description
def create_page(parent_id=None): title = "title_Of_Page_" + Helper.rand_string("randomString") description = "description_Of_Page_" + \ Helper.rand_string("randomString") createdPageId = DBCMS.insert_page(title, description) assertTrue(len(createdPageId) > 0 and not None) return title, description
def get_jenkins_job(job_name): r1 = None counter = 0 getURL = settings.JENKINS_URL + "job/" + job_name logger.debug("Get APIJenkins job URL: " + getURL) try: r1 = requests.get(getURL, auth=HTTPBasicAuth(settings.JENKINS_USERNAME, settings.JENKINS_PASSWORD)) while r1.status_code != 200 and counter <= \ Constants.GitLabConstants.RETRIES_NUMBER: r1 = requests.get( getURL, auth=HTTPBasicAuth(settings.JENKINS_USERNAME, settings.JENKINS_PASSWORD)) time.sleep(session.wait_until_time_pause) logger.debug("try to get jenkins job (try #%s)" % counter) counter += 1 Helper.internal_assert(r1.status_code, 200) logger.debug("Job was created on APIJenkins!") except BaseException: msg = None if r1 is None: msg = "APIJenkins didn't create job for %s" % job_name else: msg = "APIJenkins didn't create job for %s, " +\ "see response >>> %s %s" % ( job_name, r1.status_code, r1.reason) logger.error(msg) raise Exception(msg)
def add_vf(): try: logger.debug("Tab Add Virtual Functions") Wait.text_by_css( Constants.Dashboard.Wizard.Title.CSS, Constants.Dashboard.Wizard.AddVF.Title.TEXT, wait_for_page=True) vfName = "newVF" + Helper.rand_string("randomString") vfVersion = "newVFVersion" + \ Helper.rand_string( "randomNumber") + Helper.rand_string("randomString") Enter.text_by_name("virtualFunction", vfName) Enter.text_by_name("VFversion", vfVersion, wait_for_page=True) FEWizard.date_picker_wizard() Select(session.ice_driver.find_element_by_id( Constants.Dashboard.Wizard.AddVF.AIC_Version.TEXT )).select_by_visible_text("AIC 3.5") Select(session.ice_driver.find_element_by_id( Constants.Dashboard.Wizard.AddVF.ECOMP_Release.TEXT )).select_by_visible_text("Unknown") session.E2Edate = FEWizard.get_lab_entry_date() Click.css(Constants.SubmitButton.CSS, wait_for_page=True) Wait.page_has_loaded() Wait.name_to_dissappear("Add Virtual Function") return vfName # If failed - count the failure and add the error to list of errors. except Exception as e: errorMsg = "Failed to add a Virtual Function via modal window. " +\ "Exception " +\ str(e) raise Exception(errorMsg)
def _load_types(c): c['countries'] = Helper.find_countries() c['industries'] = Helper.find_industries_level1() p = Project() c['service_type'] = p.SERVICE_TYPES c['investment_stage'] = p.INVESTMENT_STAGE c['currency_type'] = p.PAY_CURRENCY
def invite_team_member(user_content): r1 = None postURL = settings.ICE_EM_URL + '/v1/engmgr/invite-team-members/' logger.debug("Post invite user URL: " + postURL) headers = dict() # Create header for post request. headers['Content-type'] = 'application/json' headers['Authorization'] = user_content['session_token'] data = dict() # Create JSON data for post request. data['email'] = Helper.rand_string( 'randomString') + "@" + ServiceProvider.email data['eng_uuid'] = user_content['engagement_uuid'] list_data = [] list_data.append(data) try: r1 = requests.post(postURL, json=list_data, headers=headers, verify=False) Helper.internal_assert_boolean(r1.status_code, 200) logger.debug("Invite sent successfully to email " + data['email']) invite_token = DBGeneral.select_where_and( "invitation_token", "ice_invitation", "email", data['email'], "engagement_uuid", user_content['engagement_uuid'], 1) invite_url = settings.ICE_PORTAL_URL + "/#/signUp?invitation=" + \ invite_token + "&email=" + data['email'] logger.debug("Invitation URL is: " + invite_url) return data['email'], invite_token, invite_url except BaseException: if r1 is None: logger.error("Failed to invite team member.") else: logger.error("POST request failed to invite team member, " + "see response >>> %s %s" % (r1.status_code, r1.reason)) raise
def get_to_create_new_ns_modal_via_overview(): Click.id(Constants.Dashboard.Overview.NextSteps.Add.ID, wait_for_page=True) Wait.text_by_css(Constants.Dashboard.Checklist.AddNS.CSS, Constants.Dashboard.Overview.NextSteps.Add.TITLE) Helper.internal_assert(Constants.Dashboard.Checklist.AddNS.TITLE, Get.by_css(Constants.FEGeneral.CSS.H2))
def test_ecomp_dropdown_ordering(self): new_ecomp_release = None try: new_ecomp_release = { "uuid": uuid.uuid4(), "name": Helper.rand_string() } DB.VirtualFunction.change_ecomp_release_weight(10, 0) DB.VirtualFunction.insert_ecomp_release(new_ecomp_release['uuid'], new_ecomp_release['name']) Frontend.User.login(self.user_content['el_email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( self.user_content['engagement_manual_id'], self.user_content['vfName']) Frontend.DetailedView.click_on_update_ecomp_release() Helper.internal_assert( Frontend.General.get_meta_order_of_element( Constants.Dashboard.DetailedView.ECOMP.Dropdown. UniversalRelease.ID % new_ecomp_release['name']), 0) finally: if new_ecomp_release: DB.VirtualFunction.delete_ecomp_release( new_ecomp_release['uuid'], new_ecomp_release['name']) DB.VirtualFunction.change_ecomp_release_weight(0, 10)
def validate_target_lab_entry(date): Wait.text_by_css(Constants.Dashboard.DetailedView.TargetLabEntry.CSS, Constants.Dashboard.DetailedView.TargetLabEntry.TEXT, wait_for_page=True) actualDate = Get.by_css( Constants.Dashboard.DetailedView.TargetLabEntry.CONTENT_CSS) Helper.internal_assert(actualDate, date)
def test_review_jenkins_after_archiving(self): cl_content = API.Checklist.create_checklist(self.user_content_api) DB.Checklist.state_changed("name", cl_content['name'], Constants.ChecklistStates.Review.TEXT) Frontend.User.login(self.user_content_api['el_email'], Constants.Default.Password.TEXT, self.user_content_api['engagement_manual_id']) cl_content['uuid'] = DB.Checklist.get_recent_checklist_uuid( cl_content['name'])[0] Frontend.Checklist.click_on_checklist(self.user_content_api, cl_content['name'], cl_content['uuid']) log_1 = Frontend.Checklist.get_jenkins_log() build_identifier_1 = API.Jenkins.find_build_num_out_of_jenkins_log( log_1) Frontend.Checklist.reject( 'Reject checklist as part of test_clone_decision_auditlogs test') DB.Checklist.state_changed("uuid", cl_content['uuid'], Constants.ChecklistStates.Archive.TEXT) recent_checklist_uuid = DB.Checklist.get_recent_checklist_uuid( cl_content['name'])[0] Frontend.Checklist.click_on_checklist(self.user_content_api, cl_content['name'], recent_checklist_uuid) Frontend.Checklist.update_cl_associated_files( self.user_content_api['engagement_manual_id']) DB.Checklist.state_changed("name", cl_content['name'], Constants.ChecklistStates.Review.TEXT) Frontend.General.refresh() log_2 = Frontend.Checklist.get_jenkins_log() build_identifier_2 = API.Jenkins.find_build_num_out_of_jenkins_log( log_2) Helper.internal_not_equal(build_identifier_1, build_identifier_2)
def get_git_user_ssh_key(git_user_id): r1 = None getURL = Constants.Default.URL.GitLab.Users.TEXT + \ str(git_user_id) + "/keys" logger.debug("Get user URL: " + getURL) headers = dict() # Create header for post request. headers['Content-type'] = 'application/json' headers['PRIVATE-TOKEN'] = settings.GITLAB_TOKEN try: r1 = requests.get(getURL, headers=headers, verify=False) Helper.internal_assert(r1.status_code, 200) if r1.content == '[]': logger.error("Got an empty list as a response.") raise logger.debug("Got %s %s and received user's public key." % (r1.status_code, r1.reason)) content = r1.json() # Change it from list to dict. gitPubKey = content[0]['key'] return gitPubKey except BaseException: if r1 is None: logger.error("Failed to get user's public key " + "from APIGitLab.") else: logger.error( "Failed to get user's public key from APIGitLab, " + "see response >>> %s %s \n %s" % (r1.status_code, r1.reason, str(r1.content, 'utf-8'))) raise
def get_git_project(path_with_namespace): r1 = None getURL = Constants.Default.URL.GitLab.Projects.TEXT + \ path_with_namespace logger.debug("Get project URL: " + getURL) headers = dict() # Create header for post request. headers['Content-type'] = 'application/json' headers['PRIVATE-TOKEN'] = settings.GITLAB_TOKEN try: r1 = requests.get(getURL, headers=headers, verify=False) counter = 0 while r1.status_code == 404 or r1.content == b'[]' and \ counter <= Constants.\ GitLabConstants.RETRIES_NUMBER: time.sleep(session.wait_until_time_pause) r1 = requests.get(getURL, headers=headers, verify=False) logger.debug("trying to get the git project, " + "yet to succeed (try #%s)" % counter) counter += 1 Helper.internal_assert(r1.status_code, 200) if r1.content == b'[]': logger.error("Got an empty list as a response.") raise logger.debug("Project exists on APIGitLab!") content = r1.json() # Change it from list to dict. return content except BaseException: if r1 is None: logger.error("Failed to get project from APIGitLab.") else: logger.error( "Failed to get project from APIGitLab, " + "see response >>> %s %s \n %s" % (r1.status_code, r1.reason, str(r1.content, 'utf-8'))) raise
def test_signup_page_sanity(self): ''' Purpose: Sanity test for sign-up page. Steps: - Go to sign-up page - Verify all approved vendors are listed - Verify all form fields exist. - Submit form without reCAPTCHA and verify error message. - Click on "Already have an account" and verify link. ''' Frontend.General.go_to_signup_from_login() vendors_list = DB.General.get_vendors_list() for vendor in vendors_list: Frontend.General.select_vendor_from_list(vendor) Frontend.General.form_enter_name(Helper.rand_string("randomString")) Frontend.General.form_enter_email(Helper.rand_string("email")) Frontend.General.form_enter_phone(Constants.Default.Phone.TEXT) Frontend.General.form_enter_password( Helper.rand_string("randomString")) Frontend.General.form_check_checkbox( Constants.Signup.RegularEmail.XPATH) Frontend.General.form_check_checkbox( Constants.Signup.AcceptTerms.XPATH) Frontend.General.click_on_submit() Frontend.General.verify_toast_message( Constants.Signup.Toast.Captcha.TEXT) Frontend.General.go_to_login_from_signup()
def test_validate_bucket_removed(self): bucket, user_content = self.create_bucket_and_validate_users() # set Completed Stage API.VirtualFunction.set_eng_stage(user_content, Constants.EngagementStages.COMPLETED) # validate users removed from bucket bucket_id = user_content['engagement_manual_id'] + "_" + user_content[ 'vfName'].lower() assertTrue( API.Rados.users_of_bucket_ready_after_complete( bucket_id, user_content['full_name'])) assertTrue(API.Rados.is_bucket_ready(bucket_id)) assertTrue(bucket != "None") # try create upload file - must failed str_content = Helper.rand_string("randomString") + Helper.rand_string( "randomNumber") fileName = Helper.rand_string("randomString") bucket = API.Rados.get_bucket(bucket_id) assertTrue(API.Rados.is_bucket_ready(bucket_id)) key = bucket.new_key(fileName + '.dat') key.set_contents_from_string(str_content) pprint(key.generate_url(expires_in=400)) # DOWNLOAD AN OBJECT (TO A FILE) key = bucket.get_key(fileName + '.dat') key.get_contents_to_filename('/home/' + fileName + '.dat') key.delete()
def set_ssh(user_content, sshKey=None): # Set SSH key to user. r1 = None if sshKey is None: logger.debug("About to generate an ssh key for the user: %s" % user_content['email']) sshKey = Helper.generate_sshpub_key() postURL = settings.ICE_EM_URL + '/v1/engmgr/users/ssh' logger.debug("Post user URL: " + postURL) headers = dict() # Create header for post request. headers['Content-type'] = 'application/json' headers['Authorization'] = user_content['session_token'] post_data = dict() # Create JSON data for post request. post_data['ssh_key'] = sshKey try: r1 = requests.post( postURL, json=post_data, headers=headers, verify=False) Helper.internal_assert(r1.status_code, 200) logger.debug( "SSH Key was added successfully") if not APIBridge.is_gitlab_ready(user_content): raise return sshKey except BaseException: if r1 is None: logger.error("Failed to add public SSH key.") else: logger.error( "POST request failed to add SSH key to user, " + "see response >>> %s %s" % (r1.status_code, r1.reason)) raise
def assigned_one_NS_to_user(user_content): nextStepsNumber = int( Get.by_id("next-steps-header").split('(')[1][:-1]) if (nextStepsNumber != 0): logger.error("assigned ns: " + str(nextStepsNumber)) logger.error( "APIUser should not have assigned next steps at first login.") raise if (Get.by_id("next-steps-list") != "No next steps are assigned to you."): logger.error( "No assigned next steps and text 'No next steps are " + "assigned to you.' was not found.") raise token = "token " + APIUser.login_user(user_content['el_email']) user_content['session_token'] = token logger.debug( "Adding new next step (via api) and assigning it to user " + user_content['full_name']) APIVirtualFunction.add_next_step(user_content) logger.debug("Refresh page and look for changes in assigned " + "next steps section:") FEGeneral.refresh() logger.debug(" > Check if number has changed in 'Assigned To You'") FEUser.logout() FEUser.login(user_content['email'], Constants.Default.Password.TEXT) text = Get.by_id("next-steps-header", True) Helper.internal_assert(text, "Assigned To You (1)")
def create_announcement(): title = "title_Announcement_" + Helper.rand_string("randomString") description = "description_Announcement_" + \ Helper.rand_string("randomString") postId = DBCMS.insert_cms_new_post(title, description, "Announcement") assertTrue(len(postId) > 0 and not None) return title, description
def test_search_bar(self): """ Create user and VF, log in, add VFC, search by EID, VF and VFC """ vfFullName = self.user_content[ 'engagement_manual_id'] + ": " + self.user_content['vfName'] try: Enter.text_by_id( Constants.Dashboard.LeftPanel.SearchBox.ID, self.user_content['vfName']) Wait.css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS) Click.css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS) Wait.text_by_id( Constants.Dashboard.Overview.Title.ID, vfFullName) except BaseException: errorMsg = "Failed to search by VF name." raise Exception(errorMsg) try: Enter.text_by_id( Constants.Dashboard.LeftPanel.SearchBox.ID, self.user_content['engagement_manual_id']) Enter.text_by_id( Constants.Dashboard.LeftPanel.SearchBox.ID, self.user_content['engagement_manual_id']) Wait.css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS) Click.css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS) Wait.text_by_id( Constants.Dashboard.Overview.Title.ID, vfFullName) except BaseException: errorMsg = "Failed to search by Engagement Manual ID." raise Exception(errorMsg) Frontend.Overview.click_on_vf(self.user_content) detailedViewID = Constants.Dashboard.DetailedView.ID + vfFullName Wait.text_by_id(detailedViewID, "Detailed View", wait_for_page=True) Click.id(detailedViewID, wait_for_page=True) Click.id( Constants.Dashboard.DetailedView.VFC.Add.ID, wait_for_page=True) vfcName = Helper.rand_string("randomString") extRefID = Helper.rand_string("randomNumber") Enter.text_by_name("name", vfcName) Enter.text_by_name("extRefID", extRefID, wait_for_page=True) Select(session.ice_driver.find_element_by_id( Constants.Dashboard.DetailedView.VFC.Choose_Company.ID)).\ select_by_visible_text(self.user_content['vendor']) Click.id( Constants.Dashboard.DetailedView.VFC.Save_button.ID, wait_for_page=True) try: Enter.text_by_id( Constants.Dashboard.LeftPanel.SearchBox.ID, vfcName, wait_for_page=True) Click.id( "search-" + self.user_content['vfName'], wait_for_page=True) Wait.id("clickable-" + vfFullName, wait_for_page=True) except Exception as e: errorMsg = "Failed to search by VFC name." raise Exception(errorMsg + str(e))
def signup_invited_user( company, invited_email, invite_token, invite_url, user_content, is_contact_user="******", activate=False, wait_for_gitlab=True): r1 = None postURL = settings.ICE_EM_URL + '/v1/engmgr/signup' logger.debug("Post signup URL: " + postURL) if is_contact_user == "true": fullName = re.sub("http.*full_name=", "", invite_url) fullName = re.sub("&.*", "", fullName) logger.debug( "Invited contact full name is (according to url): " + fullName) else: fullName = Helper.rand_string('randomString') post_data = dict() # Create JSON data for post request. post_data['company'] = company post_data['email'] = invited_email post_data['full_name'] = fullName post_data['invitation'] = invite_token post_data['is_contact_user'] = is_contact_user post_data['password'] = "******" post_data['phone_number'] = "+1201" + \ Helper.rand_string("randomNumber", 6) post_data['regular_email_updates'] = "False" post_data['terms'] = "True" try: requests.get(invite_url, verify=False) r1 = requests.post( postURL, json=post_data, verify=False) Helper.internal_assert(r1.status_code, 200) logger.debug("Invited user signed-up successfully!") user_data = r1.json() if activate: APIUser.activate_user( user_data['uuid'], user_data["user"]["activation_token"]) if wait_for_gitlab: if not APIBridge.is_gitlab_ready(user_content): raise return post_data except BaseException: if r1 is None: logger.error("Failed to sign up the invited team member.") else: logger.error( "POST request failed to sign up the invited " + "team member, see response >>> %s %s \n %s" % (r1.status_code, r1.reason, str( r1.content, 'utf-8'))) raise
def add_lineitem_and_check_db(): Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. FIRST_SECTION_ID) Enter.text_by_id( Constants.Dashboard.LeftPanel.EditChecklistTemplate. FIRST_SECTION_INPUT_ID, "Ros Is My Mentor") FEChecklistTemplate.click_on_save_and_assert_success_msg() result = DBChecklist.checkChecklistIsUpdated() Helper.internal_not_equal(result, None)
def validate_feedback(description, user_email): query = "SELECT user_id FROM ice_feedback where " +\ "description = '{desc}'".format( desc=description) feedback_user_uuid = DBGeneral.select_query(query) query = "SELECT id FROM ice_user_profile where " +\ "email = '{email}'".format( email=user_email) user_uuid = DBGeneral.select_query(query) Helper.internal_assert(user_uuid, feedback_user_uuid)
def verify_num_of_existing_ids(requested_num_of_ids, id_prefix): existing_id_objects_in_page = 0 ids = session.ice_driver.find_elements_by_xpath('//*[@id]') for id in ids: if id_prefix in id.get_attribute('id'): # Print id.tag_name (id name as string). logger.debug(id.get_attribute('id')) existing_id_objects_in_page += 1 Helper.internal_assert(existing_id_objects_in_page, requested_num_of_ids) logger.debug("verify_num_of_existing_ids succeeded")
def get_jenkins_log(): Click.id(Constants.Dashboard.Checklist.JenkinsLog.ID, True) Wait.text_by_id( Constants.Dashboard.Checklist.JenkinsLog.Modal.Title.ID, Constants.Dashboard.Checklist.JenkinsLog.Modal.Title.TEXT, True) log = Get.by_id(Constants.Dashboard.Checklist.JenkinsLog.Modal.Body.ID, True) Helper.assertTrue( Constants.Dashboard.Checklist.JenkinsLog.Modal.Body.TEXT_SAMPLE in log, "Jenkins log could not be viewed.") Click.id(Constants.Dashboard.Modal.CLOSE_BUTTON_ID) return log
def add_vfc(): vfcName = "VFC-" + Helper.rand_string("randomString") Click.id(Constants.Dashboard.DetailedView.VFC.Add.ID) Enter.text_by_name("name", vfcName) session.ice_driver.find_element_by_name("extRefID").click() Enter.text_by_name("extRefID", Helper.rand_string("randomNumber")) Select( session.ice_driver.find_element_by_id( Constants.Dashboard.DetailedView.VFC.Choose_Company.ID) ).select_by_visible_text(ServiceProvider.MainServiceProvider) Click.id(Constants.Dashboard.DetailedView.VFC.Save_button.ID) return vfcName
def create_new_checklist(newObj): try: newObjWithChecklist = None vfName = newObj[0] uuid = newObj[1] inviteEmail = newObj[2] # Fetch one AT&T user ID. vfuuid = DBGeneral.select_where("uuid", "ice_vf", "name", vfName, 1) engagement_id = DBVirtualFunction.select_eng_uuid(vfName) engLeadEmail = DBUser.select_el_email(vfName) logger.debug("EL email: " + engLeadEmail) engagement_manual_id = DBGeneral.select_where( "engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) # Click on all default next steps myVfName = engagement_manual_id + ": " + vfName actualVfNameid = "clickable-" + myVfName actualVfName = Get.by_id(actualVfNameid) Helper.internal_assert(myVfName, actualVfName) # NEXT STEP ID Click.id(actualVfNameid, wait_for_page=True) FEOverview.complete_defaults_nextsteps(engagement_id) inviterURL = Constants.Default.InviteURL.Signup.TEXT + \ vfuuid + "&inviter_uuid=" + uuid + "&email=" + inviteEmail # time.sleep(2) FEGeneral.re_open(inviterURL) FEGeneral.form_validate_email(inviteEmail) # Login with EL role FEGeneral.re_open(Constants.Default.LoginURL.TEXT) FEUser.login(engLeadEmail, Constants.Default.Password.TEXT) Wait.id(Constants.Dashboard.Statuses.Title.ID) Wait.id(engagement_manual_id) # cheklist # VALIDATE SCROLLING actualVfName = Get.by_id(actualVfNameid) myVfName = engagement_manual_id + ": " + vfName # Wait.id(actualVfNameid) Wait.id(engagement_manual_id, wait_for_page=True) Click.id(actualVfNameid, wait_for_page=True) # Create new checklist checklistName = FEChecklist.create_checklist( engagement_id, vfName, actualVfName, engagement_manual_id) checklistUuid = DBGeneral.select_where("uuid", "ice_checklist", "name", checklistName, 1) newObjWithChecklist = [ checklistUuid, engLeadEmail, engagement_manual_id, actualVfNameid, myVfName, checklistName ] return newObjWithChecklist # If failed - count the failure and add the error to list of errors. except Exception as e: errorMsg = "Failed to create checklist." + str(e) raise Exception(errorMsg, "create_new_checklist")
def reject_checklist(newObj, checklistName): Click.xpath("//button[2]") vfName = newObj[0] engLeadFullName = DBUser.get_el_name(vfName) Enter.text_by_name( Constants.Dashboard.Checklist.Reject.Modal.Comment.NAME, "Reject state By :" + engLeadFullName) Helper.internal_assert("Checklist: " + checklistName, Get.by_css("span.state-title.ng-binding")) Wait.text_by_id(Constants.Dashboard.Checklist.Reject.Modal.Button.ID, Constants.Dashboard.Checklist.Reject.Modal.Button.TEXT) Click.id(Constants.Dashboard.Checklist.Reject.Modal.Button.ID) Wait.modal_to_dissappear()
def add_nsteps(checklistUuid, actualVfNameid, myVfName, checklistName, newFileNames): Click.id(actualVfNameid, wait_for_page=True) checklistUuid = DBChecklist.select_where_cl_not_archive( "uuid", "ice_checklist", "name", newFileNames[0], 1) Click.id("checklist-" + checklistUuid, wait_for_page=True) Wait.text_by_id(Constants.Dashboard.Checklist.Name.ID, newFileNames[0]) FEChecklist.add_next_step_updated(checklistName, newFileNames[1]) # vALIDATE SCROLLING actualVfNameid = "clickable-" + myVfName actualVfName = Get.by_id(actualVfNameid, wait_for_page=True) if actualVfName != '': Helper.internal_assert(myVfName, actualVfName)
def create_announcements(x): listOfTitleAnDescriptions = [] for _ in range(x): # print x ->str title = "title_Announcement_" + Helper.rand_string("randomString") description = "description_Announcement_" + \ Helper.rand_string("randomString") postId = DBCMS.insert_cms_new_post(title, description, "Announcement") assertTrue(len(postId) > 0 and not None) xList = [title, description] listOfTitleAnDescriptions.append(xList) return listOfTitleAnDescriptions
def get_export_dasboard_excel(token, keywords=""): postUrl = settings.EM_REST_URL + \ "engagement/export/?stage=All&keyword=" + keywords headers = {"Authorization": token} r1 = requests.get(postUrl, headers=headers, verify=False) Helper.internal_assert(r1.status_code, 200) if (r1.status_code == 200): logger.debug("APIUser activated successfully!") return r1.content else: raise Exception("Failed to activate user >>> %s %s" % (r1.status_code, r1.reason)) return False
def get_upload_url(self): if not self.request.authorization: self.response.status = 401 self.response.headers['WWW-Authenticate'] = 'Basic realm="GAE File Manager"' self.render_json(dict(msg="Unauthorized request")) return else: user_header = base64.decodestring(self.request.authorization[1]) user_id = user_header[0:user_header.find(":")] password = user_header[user_header.find(":")+1:] log.info(user_id) log.info(password) md5_generator = hashlib.md5() md5_generator.update(password) if not Helper.fetch_entity(User, user_id=user_id, password=md5_generator.hexdigest()): self.response.status = 401 self.response.headers['WWW-Authenticate'] = 'Basic realm="GAE File Manager"' self.render_json(dict(msg="Unauthorized request")) return count = self.request.get("count") count = 1 if not count else int(count) blob_urls = [] for x in range(count): upload_url = blobstore.create_upload_url('/upload') blob_urls.append(upload_url) log.debug(blob_urls) self.render_json(dict(blob_urls=blob_urls))