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 check_empty_basket_text(self):
     message = self.browser.find_element(
         *MainPageLocators.EMPTY_BASKET_TEXT).text.strip()
     print(message)
     text_in_empty_basket = "Your basket is empty."
     assertTrue(message.startswith(text_in_empty_basket),
                f"{message}, start with {text_in_empty_basket}")
Beispiel #3
0
    def test_e2e_checklist_reject(self):
        newObj, user_content = API.User.create_new_user_content()
        newObjWithChecklist = Frontend.Checklist.create_new_checklist(newObj)
        checklistUuid = newObjWithChecklist[0]
        engLeadEmail = newObjWithChecklist[1]
        engagement_manual_id = newObjWithChecklist[2]
        actualVfNameid = newObjWithChecklist[3]
        checklistName = newObjWithChecklist[5]
        DB.Checklist.state_changed("uuid", checklistUuid,
                                   Constants.ChecklistStates.Review.TEXT)
        DB.Checklist.update_decisions(checklistUuid, checklistName)
        Frontend.User.relogin(engLeadEmail, Constants.Default.Password.TEXT,
                              engagement_manual_id)
        Frontend.Checklist.click_on_checklist(user_content, checklistName)
        Frontend.Checklist.validate_reject_is_enabled()
        Frontend.Checklist.review_state_actions_and_validations(
            checklistName, user_content['vfName'], "review")
        Frontend.Checklist.cl_to_next_stage(actualVfNameid)
        engPreeRiviewerLeadEmail = DB.Checklist.get_pr_email(checklistUuid)
        Frontend.User.relogin(engPreeRiviewerLeadEmail,
                              Constants.Default.Password.TEXT)
        Frontend.Checklist.click_on_checklist(user_content, checklistName)
        Frontend.Checklist.validate_reject_is_enabled()
        Frontend.Checklist.review_state_actions_and_validations(
            checklistName, user_content['vfName'], "PEER")

        Frontend.Checklist.reject_checklist(newObj, checklistName)

        archive = DB.Checklist.is_archive(checklistName)
        assertTrue(archive)
Beispiel #4
0
 def validate_multi_eng(user_content, checklist_content, newEL_content,
                        actualVfNameid):
     query = "UPDATE ice_user_profile SET role_id=2 WHERE email = '" + \
         str(newEL_content['email']) + "';"
     DBGeneral.update_by_query(query)
     FEWizard.invite_team_members_modal(newEL_content['email'])
     # Fetch one AT&T user ID.
     enguuid = DBGeneral.select_where("uuid", "ice_engagement",
                                      "engagement_manual_id",
                                      user_content['engagement_manual_id'],
                                      1)
     invitation_token = DBUser.select_invitation_token(
         "invitation_token", "ice_invitation", "engagement_uuid", enguuid,
         newEL_content['email'], 1)
     URL = Constants.Default.InviteURL.Login.TEXT + invitation_token
     FEGeneral.re_open(URL)
     FEUser.login(newEL_content['email'],
                  Constants.Default.Password.TEXT,
                  expected_element=actualVfNameid)
     Click.id(actualVfNameid, wait_for_page=True)
     count = None
     try:
         session.ice_driver.find_element_by_id("checklist-" +
                                               checklist_content['uuid'])
         count += 1
     except BaseException:
         logger.debug("check list not visible for EL invited : " +
                      str(newEL_content['email']))
     assertTrue(count is None)
     query = "UPDATE ice_user_profile SET role_id=1 WHERE email = '" + \
         str(newEL_content['email']) + "';"
     DBGeneral.update_by_query(query)
 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 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
Beispiel #7
0
    def test_receives_status_code_4_if_operation_is_failed(self):
        # Implement some logic here in order to being thrown 'sending message exception'
        payload = MessageTestDataBuilder().build()

        sut = requests.post(self._url, payload)
        sut_response_json = json.loads(sut.text)

        assertTrue(sut_response_json['statusCode'] == 4,
                   'Expects to receive "4" status code.')
Beispiel #8
0
    def test_user_is_authorized_if_credentials_are_valid(self, driver):
        user_login = '******'
        user_password = '******'

        login_page = LoginPage(driver).open()

        sut = login_page.login_as(user_login, user_password)

        assertTrue(sut.is_it_home_page, self._DEFAULT_ERROR_MESSAGE)
 def addPublic(self):
     sleep(2)
     assertTrue(el.toCompareDesc('个人认证'))
     sleep(2)
     el.LocalizeDesc('worker-back').click()
     sleep(2)
     el.LocalizeDesc('foot-add').click()
     sleep(2)
     assertTrue(el.toCompareDesc('首页'))
Beispiel #10
0
    def test_receives_status_code_3_if_operation_is_failed(self):
        payload = MessageTestDataBuilder() \
            .with_not_valid_body() \
            .build()

        sut = requests.post(self._url, payload)
        sut_response_json = json.loads(sut.text)

        assertTrue(sut_response_json['statusCode'] == 3,
                   'Expects to receive "3" status code.')
Beispiel #11
0
    def test_user_is_not_authorized_if_credentials_are_not_valid(self, driver):
        fake = Faker()
        user_login = fake.pystr()
        user_password = fake.pystr()

        login_page = LoginPage(driver).open()

        sut = login_page.login_as_expecting_error(user_login, user_password)

        assertTrue(sut.is_it_login_page, self._DEFAULT_ERROR_MESSAGE)
Beispiel #12
0
def step_impl(context, status, errorCode, errorMsg):
    global scene
    scene += 1

    print("接口响应", context.respones, "\n")

    context.status = status

    print(context.status)

    assertTrue(context.status, context.respones.get('status'))
 def testCase_007(self):
     """【我的】--【>】--【认证页】"""
     sleep(1)
     el.LocalizeDesc('我的').click()
     sleep(2)
     el.LocalizeDesc('my-row').click()
     sleep(2)
     assertTrue(el.toCompareDesc('个人认证'))
     sleep(2)
     el.LocalizeDesc('worker-back').click()
     sleep(2)
     assertTrue(el.toCompareDesc('首页'))
Beispiel #14
0
 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
Beispiel #15
0
    def test_email_is_required_field(self, driver):
        fake = Faker()
        user_password = fake.pystr()

        login_page = LoginPage(driver).open()
        login_page.type_password(user_password)

        sut = login_page.submit_login_expecting_failure()

        assertTrue(sut.is_it_login_page, self._DEFAULT_ERROR_MESSAGE)
        assertTrue(
            sut.is_email_message_error_appeared,
            "Can not find an error message about required email field.")
 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()
Beispiel #17
0
def create_organization(context, name):
    context.browser.find_element(*HomePageLocator.My_organizations_btn).click()
    time.sleep(1)
    btn = context.browser.find_element(
        *HomePageLocator.Create_new_organization_btn)
    assertTrue(btn)
    context.browser.find_element(
        *HomePageLocator.Create_new_organization_btn).click()
    time.sleep(5)
    context.browser.find_element(*OrganizationPopup.TITLE).send_keys(name)
    context.browser.find_element(
        *OrganizationPopup.DESC).send_keys("Test organization")
    context.browser.find_element(*OrganizationPopup.SUBMIT).click()
    time.sleep(1)
 def test_XSS_script(self):
     user_content = API.VirtualFunction.create_engagement(
         wait_for_gitlab=False)
     validate = API.User.update_account_injec_script(user_content)
     assertTrue(validate)
     Frontend.User.login(user_content['email'],
                         Constants.Default.Password.TEXT)
     Frontend.User.open_account_form()
     script = "<script>;</script>"
     Enter.text_by_name("fullname", script, wait_for_page=True)
     Wait.text_by_css(Constants.SubmitButton.CSS, "Update")
     Click.css(Constants.SubmitButton.CSS, wait_for_page=True)
     Wait.text_by_css(Constants.Toast.CSS,
                      "Account was updated successfully!")
 def testCase_003(self):
     """【找任务】--【发布任务】--【认证页】"""
     sleep(2)
     el.LocalizeDesc(u'找任务').click()
     sleep(2)
     el.tap([(950, 133)], 200)
     sleep(2)
     el.localizeId('android:id/button1').click()
     sleep(2)
     assertTrue(el.toCompareDesc('个人认证'))
     sleep(2)
     el.LocalizeDesc('worker-back').click()
     sleep(2)
     el.tap([(70, 150)], 200)
     sleep(2)
     assertTrue(el.toCompareDesc('首页'))
Beispiel #20
0
    def context_embed(self, embed, batch_features):
        context_indices = batch_features.context_indices
        B, T, WS = context_indices.size()
        B_embed, T_embed, dim = embed.size()
        if assertTrue((B == B_embed) and (T == T_embed)) is False:
            print("invalid argument")
            exit()
        context_indices = context_indices.view(B, T * WS)
        if self.config.use_cuda is True:
            context_np = context_indices.data.cpu().numpy()
        else:
            context_np = np.copy(context_indices.data.numpy())
        for i in range(B):
            for j in range(T * WS):
                context_np[i][j] = T * i + context_np[i][j]
        if self.config.use_cuda is True:
            context_indices = Variable(torch.from_numpy(context_np)).cuda()
        else:
            context_indices = Variable(torch.from_numpy(context_np))
        context_indices = context_indices.view(
            context_indices.size(0) * context_indices.size(1))

        embed = embed.view(B * T, dim)
        if self.config.use_cuda is True:
            pad_embed = Variable(torch.zeros(1, dim)).cuda()
        else:
            pad_embed = Variable(torch.zeros(1, dim))
        embed = torch.cat((embed, pad_embed), 0)
        context_embed = torch.index_select(embed, 0, context_indices)
        context_embed = context_embed.view(B, T, -1)

        return context_embed
 def helperQuit(self):
     """找帮手退出"""
     sleep(2)
     el.LocalizeDesc('与TA聊聊').click()
     sleep(2)
     el.localizeId('android:id/button1').click()
     el.stime(2)
     assertTrue(el.toCompareDesc(u'个人认证'))
     el.stime(2)
     el.LocalizeDesc('worker-back').click()
     el.stime(2)
     el.LocalizeDesc('worker-back').click()
     el.stime(2)
     el.localizeXpath('//android.view.View[@content-desc=\"\"]').click()
     el.stime(2)
     assertTrue(el.toCompareDesc('首页'))
Beispiel #22
0
    def test_receives_status_code_0_if_operation_is_successful(self):
        # Filling with some valid data
        payload = MessageTestDataBuilder() \
            .with_body("") \
            .with_country_code2("") \
            .with_email("") \
            .with_lang("") \
            .with_name("") \
            .with_product(ProductType.SOFT_1) \
            .with_type(MessageType.FEEDBACK) \
            .build()

        sut = requests.post(self._url, payload)
        sut_response_json = json.loads(sut.text)

        assertTrue(sut_response_json['statusCode'] == 0,
                   'Expects to receive "0" status code.')
 def test_permissions_stage_completed(self):
     bucket, user_content = self.create_bucket_and_validate_users()
     API.VirtualFunction.set_eng_stage(user_content,
                                       Constants.EngagementStages.COMPLETED)
     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))
     bucket = API.Rados.get_bucket(bucket_id)
     grants = API.Rados.get_bucket_grants(bucket_id)
     print("\nBucket:", bucket)
     print("\nBucket Type:", type(bucket))
     print("\nGrants:", grants)
     print("\nGrants Type:", type(grants))
     print("done")
 def test_validate_bucket_created(self):
     bucket, user_content = self.create_bucket_and_validate_users()
     # create upload file
     str_content = Helper.rand_string("randomString") + Helper.rand_string(
         "randomNumber")
     fileName = Helper.rand_string("randomString")
     bucket_id = user_content['engagement_manual_id'] + "_" + user_content[
         'vfName'].lower()
     Wait.bucket_to_create(bucket_id)
     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()
Beispiel #25
0
 def testCase_001(self):
     u"""手机号登录用例"""
     # el.sony()
     el.stime(5)
     sleep(4)
     # el.LocalizeDesc('login-1').click()
     el.tap([(550, 765)], 200)
     el.stime(5)
     el.LocalizeDesc('请输入您的手机号').send_keys('18900000000')
     # el.LocalizeDesc('获取验证码').click()
     el.baidu()
     sleep(1)
     # el.LocalizeDesc('验证码').send_keys(msm())
     el.LocalizeDesc('验证码').send_keys(5555)
     el.LocalizeDesc('login-title').click()
     el.LocalizeDesc('登录').click()
     el.stime(10)
     assertTrue(el.toCompareDesc('任务推荐'))
    def test_multi_cols(self):
        overlayer = Networker(TestZipOverlayer.TEST_FILE_TWO_COLS,
                              columns=[0, 1])
        node1_zip = overlayer['node1']
        assertTrue(self.is_zip(node1_zip))

        node2_zip = overlayer['node2']
        assertTrue(self.is_zip(node2_zip))

        node3_zip = overlayer['node3']
        assertTrue(self.is_zip(node3_zip))

        node4_zip = overlayer['node4']
        assertTrue(self.is_zip(node4_zip))
 def test_validate_upload_download_image_with_bucket_user(self):
     bucket, user_content = self.create_bucket_and_validate_users()
     # connect to bucket with specific user
     bucket_id = user_content['engagement_manual_id'] + "_" + user_content[
         'vfName'].lower()
     access_key = DBUser.get_access_key(user_content['uuid'])
     secret_key = DBUser.get_access_secret(user_content['uuid'])
     secret = CryptographyText.decrypt(secret_key)
     bucket_for_specific_user = API.Rados.get_bucketfor_specific_user(
         bucket_id, access_key, secret)
     assertTrue(bucket_for_specific_user is not None)
     # create upload file with user
     str_content = Helper.rand_string("randomString") + Helper.rand_string(
         "randomNumber")
     fileName = Helper.rand_string("randomString")
     key = bucket_for_specific_user.new_key(fileName + '.dat')
     key.set_contents_from_string(str_content)
     pprint(key.generate_url(expires_in=3600))
     #         DOWNLOAD AN OBJECT (TO A FILE)
     key = bucket_for_specific_user.get_key(fileName + '.dat')
     key.get_contents_to_filename('/home/' + fileName + '.dat')
     key.delete()
    def test_multi_cols_extra_info(self):
        overlayer = Networker(TestZipOverlayer.TEST_FILE_TWO_COLS_EXTRA_COLS,
                              columns=[0, 2])
        node1_zip = overlayer['node1']
        assertTrue(self.is_zip(node1_zip))

        node2_zip = overlayer['node2']
        assertTrue(self.is_zip(node2_zip))

        node3_zip = overlayer['node3']
        assertTrue(self.is_zip(node3_zip))

        node4_zip = overlayer['node4']
        assertTrue(self.is_zip(node4_zip))

        # There should be no others:
        self.assertEqual(len(overlayer), 4)
Beispiel #29
0
    def test_email_and_password_are_required_fields(self, driver):
        login_page = LoginPage(driver).open()

        sut = login_page.submit_login_expecting_failure()

        assertTrue(sut.is_it_login_page, self._DEFAULT_ERROR_MESSAGE)
        assertTrue(
            sut.is_email_message_error_appeared,
            "Can not find an error message about required password field.")
        assertTrue(
            sut.is_password_message_error_appeared,
            "Can not find an error message about required email field.")
    def create_bucket_and_validate_users(self):
        user_content = API.VirtualFunction.create_engagement(
            wait_for_gitlab=True)
        API.VirtualFunction.set_eng_stage(user_content,
                                          Constants.EngagementStages.ACTIVE)
        bucket_id = user_content['engagement_manual_id'] + "_" + user_content[
            'vfName'].lower()
        Wait.bucket_to_create(bucket_id)
        bucket = API.Rados.get_bucket(bucket_id)
        assertTrue(API.Rados.is_bucket_ready(bucket_id))
        assertTrue(bucket != "None")
        assertTrue(
            API.Rados.users_of_bucket_ready_after_created(
                bucket_id, user_content['uuid']))
        # validate users added to bucket
        grants = API.Rados.get_bucket_grants(bucket_id)
        count = 0
        for g in grants:
            if g.id == user_content['uuid']:
                count = +1

        assertTrue(count > 0)
        return bucket, user_content
Beispiel #31
0
    def test_cmscan_to_metadata(self):
        # positive controls: will the information from a file parsed to what
        # we expect
        assertTrue(self.seq1 == _cmscan_to_metadata(self.file_valid, rec_num=1))
        assertTrue(self.seq2 == _cmscan_to_metadata(self.file_valid, rec_num=2))

        # negative control: we are parsing the wrong information from the file,
        # check if it is really unequal
        assertTrue(not self.seq1 == _cmscan_to_metadata(self.file_valid,
                                                        rec_num=2))

        # test if parser raises error about an unknown character as strand
        # identifier
        self.assertRaisesRegex(CmscanFormatError,
                               "Unknown strand character",
                               _cmscan_to_metadata,
                               self.file_invalidOrientation,
                               rec_num=1)

        # test if parser complains about non digit characters in positional
        # arguments
        self.assertRaisesRegex(CmscanFormatError,
                               "must be an integer value for the start position"
                               " of the hit. Here, it is",
                               _cmscan_to_metadata,
                               self.file_charInPos,
                               rec_num=1)

        # test if parser checks for wrong start and stop positions of the hit
        # in the query sequence
        self.assertRaisesRegex(CmscanFormatError,
                               "It might be, that this hit is in fact on the "
                               "reverse strand. Please check strand orientation"
                               " and positions",
                               _cmscan_to_metadata,
                               self.file_startStopSwop,
                               rec_num=1)
Beispiel #32
0
 def test_cmscan_to_generator(self):
     assertTrue(list(_cmscan_to_generator(self.file_valid))[0] == self.seq1)
     assertTrue(list(_cmscan_to_generator(self.file_valid))[1] == self.seq2)
     assertTrue(not list(_cmscan_to_generator(self.file_valid))[0] == self.seq2)