Пример #1
0
 def test_add_public_account(self):
     name = const.qq
     with step('新增公众号'):
         self._pam.add_public_account(name=name)
     with step('新增后查询'):
         self._pam.query_public_account(name=name)
         assert GLOBAL_VAR['gzh_name'] == name
Пример #2
0
 def setup_class(cls):
     test_class = cls.pytestmark[0].args[0]
     super(TestSuite, cls).setup_class(test_class)
     with step('Initialise class'):
         cls.test_screen = IceScreen(cls.driver)
         cls.comment_card_screen = CommentCardScreen(cls.driver)
         cls.login_screen = LoginScreen(cls.driver)
         cls.reservation_screen = ReservationScreen(cls.driver)
         cls.recreation_screen = RecreationScreen(cls.driver)
         cls.store_screen = StoreScreen(cls.driver)
         cls.services_screen = RequestsScreen(cls.driver)
         cls.custom_screen = CustomScreen(cls.driver)
         cls.advertising_screen = AdvertisingScreen(cls.driver)
         cls.transportation_screen = TransportationScreen(cls.driver)
         cls.dining_screen = DiningScreen(cls.driver)
         cls.maps_screen = MapsScreen(cls.driver)
         cls.daily_events_screen = DailyEventsScreen(cls.driver)
         cls.spa_screen = SpaScreen(cls.driver)
         cls.dashboard_screen = DashboardScreen(cls.driver)
         cls.ice_screen.wait_till_loader_disappear()
     if os.getenv('PLATFORM') == 'ios':
         cls.ice_screen.accept_alert()
         cls.ice_screen.open_and_close_profile_menu()
     with step('Change remote settings'):
         cls.ice_screen.change_remote_settings()
Пример #3
0
 def test_app_with_wrong_flag(self, prepare_package):
     flag = 'wrong_flag'
     with step('Install package with flag'):
         result = self.apt_get_methods.install_package_with_flag(
             prepare_package[0], [flag])
     with step('Check correct error present'):
         assert f'Command line option --{flag} is not understood in combination with the other options' \
                in result['err'], 'Wrong message'
Пример #4
0
 def test_success_install_app(self, prepare_package):
     with step('Install package'):
         result = self.apt_get_methods.install_package(prepare_package[0])
     with step('Check no error present'):
         assert not result['err']
     with step('Check package installed'):
         assert self.apt_get_methods.check_package_installed(
             prepare_package[0])
Пример #5
0
 def test_install_app_with_unknown_version(self, prepare_package):
     version = '3.66'
     with step('Install package with unknown version'):
         result = self.apt_get_methods.install_package_with_version(
             prepare_package[0], version)
     with step('Check correct error present'):
         assert f"Version '{version}' for '{prepare_package[0]}' was not found" in result[
             'err'], 'Wrong error message'
Пример #6
0
 def test_several_apps(self, prepare_package):
     with step('Install package'):
         result = self.apt_get_methods.install_packages(prepare_package)
     with step('Check no error present'):
         assert not result['err']
     with step('Check package installed'):
         for package in prepare_package:
             assert self.apt_get_methods.check_package_installed(package)
Пример #7
0
 def test_app_with_flag(self, prepare_package):
     with step('Install package with flag'):
         result = self.apt_get_methods.install_package_with_flag(
             prepare_package[0], ['quiet'])
     with step('Check no error present'):
         assert not result['err']
     with step('Check package installed'):
         assert self.apt_get_methods.check_package_installed(
             prepare_package[0])
Пример #8
0
 def test_wechat_flow_editor(self):
     self.ef = EditorFlow()
     new_name = random_ean8()
     with step('创建微信流量广告计划,并保存id'):
         self._cap.ad_plan(gatherType=3)
     with step('修改“计划名称”,“投放渠道”,“广告类型”;“提交”'):
         self.ef.editor_flow(plan_name=new_name, gather_type=3)
         self._cap.query_ad_plan(id=GLOBAL_VAR['adId'], gatherType=3)
         assert GLOBAL_VAR['newName'] == new_name
Пример #9
0
 def test_advertising_works_with_changed_language(self):
     with step('Switch language to Russian'):
         self.ice_screen.language_switch('russian')
     with step('Tap on ad screen'):
         self.advertising_screen.open_advertising_menu()
     with step('Check ad screen opened and contains ads'):
         self.advertising_screen.check_correctness_of_ad_menu()
     with step('Switch language to English'):
         self.ice_screen.language_switch('english')
Пример #10
0
 def test_failure_update(self):
     if rc.get_env() == 'pre':
         login.login_action('t0396753586')
     else:
         login.login_action('t0373492024')
     with step('先查询获得历史数据,让该数据失效'):
         self._bm.query_budget_data()
         self._bm.failure_budget_data()
     with step('点击该已失效得修改功能'):
         self._bm.failure_update_record()
Пример #11
0
 def test_turn_page_query_ad_data(self):
     if rc.get_env() == 'pre':
         login.login_action('t0322511032')
     else:
         login.login_action('t0373492024')
     with step('查询'):
         self._ad.query_ad_data()
     with step('翻页查询'):
         self._ad1 = AdData()
         self._ad1.query_ad_data(pageIndex=2)
Пример #12
0
 def test_del_public_account(self):
     name = const.qq
     with step('新增公众号'):
         self._pam.add_public_account(name=name)
     with step('新增后查询获取公众号ID'):
         self._pam.query_public_account(name=name)
     with step('删除公众号'):
         self._pam.del_public_account()
         self._pam.query_del_public_account(name=name)
         assert GLOBAL_VAR['totalItem'] == '0'
Пример #13
0
 def test_phone_flow_del_cons(self):
     with step('创建手机广告计划'):
         self._cap.ad_plan(gatherType=1)
     with step('创建手机广告创意'):
         self._cwp.get_plan_id(gatherType=1)
         self._cwai.create_ad_idea()
         self._cwai.get_idea_id(gatherType=1)
     with step('新增广告数据'):
         self._cwai.add_ad_data()
         self._cwai.get_ad_data_id()
         self._cwai.del_ad_data()
Пример #14
0
 def test_editor_public_account(self):
     name = const.qq
     wx = const.title
     with step('新增公众号'):
         self._pam.add_public_account(name=name)
     with step('新增后查询获取公众号ID'):
         self._pam.query_public_account(name=name)
     with step('编辑公众号'):
         self._pam.editor_public_account(wx=wx)
         self._pam = PublicAccountManager()
         self._pam.query_public_account(name=name)
         assert GLOBAL_VAR['gzh_wx'] == wx
Пример #15
0
 def test_qq_flow_editor(self):
     new_name = random_ean8()
     eif = EditorIdeaFlow()
     with step('创建QQ广告计划'):
         self._cap.ad_plan(gatherType=2, allocInstType=3)
     with step('创建QQ广告创意'):
         self._cwai.create_qq_idea()
         self._cwai.get_idea_id(gatherType=2)
         eif.editor_qq_idea_flow(name=new_name, remark='123', gather_type=2)
         self._cwai.get_idea_id(gatherType=2)
         assert GLOBAL_VAR['newName'] == new_name
         assert GLOBAL_VAR['remark'] == '123'
Пример #16
0
 def test_install_app_with_same_version(self, prepare_package):
     with step('Install package'):
         self.apt_get_methods.install_package_with_version(
             prepare_package[0], self.new_version)
     with step('Reinstall package with the same version'):
         result = self.apt_get_methods.install_package_with_version(
             prepare_package[0], self.new_version)
     with step('Check no error present'):
         assert not result['err']
     with step('Check package installed'):
         assert self.apt_get_methods.check_package_installed(
             prepare_package[0], version=self.new_version)
Пример #17
0
 def test_phone_flow_editor(self):
     new_name = random_ean8()
     eif = EditorIdeaFlow()
     with step('创建手机广告计划'):
         self._cap.ad_plan(gatherType=1)
     with step('创建手机广告创意'):
         self._cwp.get_plan_id(gatherType=1)
         self._cwai.create_ad_idea()
         self._cwai.get_idea_id(gatherType=1)
         eif.editor_idea_flow(name=new_name, position='12345', remark='123')
         self._cwai.get_idea_id(gatherType=1)
         assert GLOBAL_VAR['newName'] == new_name
         assert GLOBAL_VAR['remark'] == '123'
         assert GLOBAL_VAR['position'] == '12345'
Пример #18
0
 def test_wechat_flow_editor(self):
     new_name = random_ean8()
     eif = EditorIdeaFlow()
     with step('创建手机广告计划'):
         self._cap.ad_plan(gatherType=3)
     with step('创建手机广告创意'):
         self._cwp.get_plan_id(gatherType=3)
         self._cwai.create_person_wc_ad_idea()
         self._cwai.get_idea_id(gatherType=3)
         eif.editor_wechat_idea_flow(name=new_name,
                                     remark='123',
                                     gather_type=3)
         self._cwai.get_idea_id(gatherType=3)
         assert GLOBAL_VAR['newName'] == new_name
         assert GLOBAL_VAR['remark'] == '123'
Пример #19
0
 def delete_issue(issue_id):
     with step("Delete issue by ID"):
         result = HttpManager.delete(Api.DELETE_ISSUE.format(issue_id))
         Api.LOGGER.info(
             'TEST: Delete issue. Method: {0}, URL : {1}'.format(
                 "DELETE", Api.DELETE_ISSUE.format(issue_id)))
         return result
def test_search_exception_not_found():
    with step("-->Проверяем исключение"):
        with raises(ValueError):
            binar_search(-1, [2, 3, 4, 5])

        with raises(ValueError):
            with step("-->Проверяем исключение"):
                binar_search(1, [2, 3, 4, 5])

        with raises(ValueError):
            with step("-->Проверяем исключение"):
                binar_search(5, [1, 2, 3, 4])

        with raises(ValueError):
            with step("-->Проверяем исключение"):
                binar_search(3, [1, 2, 4, 5])
Пример #21
0
def _attach_response(response: RequestsResponse):
    response_json = None
    try:
        response_json = response.json()
    except ValueError:
        pass
    with step(f"{response.request.method}: {response.request.url}"):
        attach(_dump_headers(response.request.headers), 'request.headers',
               AttachmentType.TEXT)

    with step(f"response → {response.status_code}"):
        if response_json:
            attach(_dump(response_json), 'response.json', AttachmentType.JSON)
        if response.text:
            attach(response.text, 'response.text', AttachmentType.TEXT)
        attach(_dump_headers(response.headers), 'response.headers',
               AttachmentType.JSON)
Пример #22
0
 def test_failure_budget_data(self):
     if rc.get_env() == 'pre':
         login.login_action('t0396753586')
     else:
         login.login_action('t0373492024')
     with step('先查询获得历史数据'):
         self._bm.query_budget_data()
         self._bm.failure_budget_data()
Пример #23
0
 def test_crud_user(self):
     with step('Create new user'):
         generated_body = self.users_data_generator.generate_user_body()
         created_user = self.users_api.create_user(generated_body)
     with step('Check user appeared in the list'):
         users = self.users_api.get_all_users(
             name=generated_body['dict']['name'])
         assert created_user['id'] in [
             _['id'] for _ in users
         ], 'Create user missed in the total list'
     with step('Delete user'):
         self.users_api.delete_user(created_user['id'])
     with step('Check user missed in the list'):
         users = self.users_api.get_all_users(
             first_name=generated_body['dict']['name'])
         assert created_user['id'] not in [
             _['id'] for _ in users
         ], 'Deleted user still present in the total list'
Пример #24
0
 def create_issue(project_key):
     with step("Create issue"):
         result = HttpManager.post(
             Api.CREATE_ISSUE, JSONFixture.for_create_issue(project_key))
         Api.LOGGER.info(
             'TEST: Create issue. Method: {0}, Data: {1}'.format(
                 "POST", JSONFixture.for_create_issue(project_key)))
         # TODO with this line allure report isn't generated - allure.attach("Create issue", JSONFixture.for_create_issue(project_key), AttachmentType.TEXT)
         return result
Пример #25
0
    def login():
        with step("Login"):
            url = Api.BASE_URL
            user_name = Api.parser.get('jira', 'username')
            password = Api.parser.get('jira', 'password')

            result = HttpManager.auth(url, user_name, password)
            Api.LOGGER.info('TEST: Login with {0}, {1} credentials'.format(user_name, password))
            assert 200 == result.status_code
Пример #26
0
 def test_install_app_with_lower_version(self, prepare_package):
     with step('Install package'):
         self.apt_get_methods.install_package_with_version(
             prepare_package[0], self.new_version)
     with step('Reinstall package with lower version'):
         result = self.apt_get_methods.install_package_with_version(
             prepare_package[0], self.old_version)
     with step('Check error present without allowing downgrades'):
         assert 'Packages were downgraded and -y was used without --allow-downgrades' in result[
             'err']
     with step('Check no error present with allowing downgrades'):
         result = self.apt_get_methods.install_package_with_flag(
             f'{prepare_package[0]}={self.old_version}',
             ['allow-downgrades'])
         assert not result['err']
     with step('Check package installed'):
         assert self.apt_get_methods.check_package_installed(
             prepare_package[0], version=self.old_version)
Пример #27
0
    def login():
        with step("Login"):
            url = Api.USER_AUTH
            user_name = Api.config.get('api', 'login')
            password = Api.config.get('api', 'password')
            data = JSONFixture.authorization(user_name, password)

            result = HttpManager.auth(url, data)
            Api.LOGGER.info(f'TEST: Login with {user_name}, {password} credentials')
            return result
Пример #28
0
 def test_update_budget_data(self):
     if rc.get_env() == 'pre':
         login.login_action('t0396753586')
     else:
         login.login_action('t0373492024')
     with step('先查询获得历史数据'):
         self._bm.query_budget_data()
     with step('修改'):
         self._bm.update_budget_data(workDay=5,
                                     monthEntryNum=5,
                                     monthUnCorrectNum=5,
                                     monthCorrectNum=5,
                                     avgCardNum=5,
                                     conversionRate=0.17,
                                     customerPrice=777)
         self._bm = BudgetMgt()
         self._bm.query_budget_data()
         assert GLOBAL_VAR['workDay'] == '5' and GLOBAL_VAR[
             'conversionRate'] == '0.17'
Пример #29
0
 def test_phone_flow_cons_change(self):
     with step('创建手机广告计划'):
         self._cap.ad_plan(gatherType=1)
     with step('创建手机广告创意'):
         self._cwp.get_plan_id(gatherType=1)
         self._cwai.create_ad_idea()
         self._cwai.get_idea_id(gatherType=1)
     with step('新增广告数据'):
         self._cwai.add_ad_data()
         self._cwai.get_ad_data_id()
         self._cwai.change_ad_data(noExposure=2,
                                   noClicks=2,
                                   cost=2,
                                   rebates=1.3)
     with step('验证修改结果'):
         self._cwai.get_ad_data_id()
         assert int(GLOBAL_VAR['noExposure']) == 2
         assert int(GLOBAL_VAR['noClicks']) == 2
         assert GLOBAL_VAR['cost'] == '2.0'
         assert GLOBAL_VAR['rebates'] == '1.3'
Пример #30
0
    def login():
        with step("Login"):
            # user_name = Api.data["login"]
            # password = Api.data["password"]
            result = HttpManager.auth(Constants.LOGIN_ISSUE, Api.data)

            response_json = result.json()

            Api.token = response_json["token"]
            assert Api.token is not None
            # Api.LOGGER.info('TEST: Login with {0}, {1} credentials'.format())
            assert 200 == result.status_code