Example #1
0
    def test_manual_xk(self):
        with step('创建微信计划'):
            self._cwp.create_wc_ad_plan_for_model()
            self._cwp.get_plan_id()
        with step('创建微信广告创意'):
            self._cwai = CreateAdIdea()
            self._cwai.create_wc_ad_idea()
            self._cwai.get_idea_id()
        with step('新建落地页'):
            self._cqc = CreateQrCode()
            self._cqc.create_pay_qr_code()
            self._cqc.publish_website()
            self._cqc.create_link()
            #create_code()
        with step('落地页数据列表统计查询'):
            self._cqc.ldy_list_data_query()
        with step('入库记录流量数据查询'):
            self._prq = PutRecordQuery()
            self._prq.put_record_query()
        with step('广告创意流量数据查询'):
            self._cwai.ad_idea_flow_data_query()


# if __name__ == '__main__':
#     import pytest
#     pytest.main([__file__])
Example #2
0
 def setup(self):
     self._cwp = CreateAdPlan()
     self._cwai = CreateAdIdea()
     self._cqc = CreateQrCode()
     self._prq = PutRecordQuery()
     GLOBAL_VAR['projectName'] = const.projectName
     GLOBAL_VAR['ideaName'] = const.ideaName
Example #3
0
class TestAddPageWithApi:
    def setup(self):
        GLOBAL_VAR['landingPageName'] = const.landingPageName
        self.lpwa = LPWA()
        self.cqc = CQC()
        self.lpm = LandingPageMgt()
        self.cwai = CreateAdIdea()
        self.prq = PutRecordQuery()

    @logger('case')
    @allure.step('企业微信模式-不带商品')
    def test_add_page_with_api_no_goods(self):
        with allure.step('新建落地页'):
            self.lpwa = LPWA()
            self.lpwa.save_page(type=1)
            self.cqc.publish_website()
            self.lpwa.association_creativity()
        # with allure.step('生成二维码'):
        #     tools.create_code()
        with allure.step('查询落地页管理列表'):
            self.lpm.page_list()

    @logger('case')
    @allure.step('企业微信模式-带商品')
    def test_add_page_with_api_take_goods(self):
        with allure.step('新建落地页'):
            self.lpwa = LPWA()
            self.lpwa.save_page(type=2)
            self.cqc.publish_website()
            self.lpwa.association_creativity()
        # with allure.step('生成二维码'):
        #     tools.create_code()
        with allure.step('查询落地页管理列表'):
            self.lpm.page_list()

    @logger('case')
    @allure.step('一键提交模式-手动分配')
    def test_add_page_with_api_1(self):
        with allure.step(''):
            self.lpwa.save_page(type=3)
            self.cqc.publish_website()
            self.lpwa.association_creativity(type=2)
        # with allure.step('生成二维码'):
        #     tools.create_code()
        with allure.step('查询落地页管理列表'):
            self.lpm.page_list()

    @logger('case')
    @allure.step('一键提交模式-直线下发')
    def test_add_page_with_api_2(self):
        with allure.step('新建落地页'):
            self.lpwa.save_page(type=3)
            self.cqc.publish_website()
            self.lpwa.association_creativity(type=3)
        # with allure.step('生成二维码'):
        #     tools.create_code()
        with allure.step('查询落地页管理列表'):
            self.lpm.page_list()
Example #4
0
 def setup(self):
     GLOBAL_VAR['landingPageName'] = const.landingPageName
     self.lpwa = LPWA()
     self.cqc = CQC()
     self.lpm = LandingPageMgt()
     self.cwai = CreateAdIdea()
     self.prq = PutRecordQuery()
Example #5
0
 def test_line_vip(self):
     with step('创建微信计划'):
         self._cwp.create_wc_ad_plan_for_model(put_model=3)
         self._cwp.get_plan_id()
     with step('创建微信广告创意'):
         self._cwai = CreateAdIdea()
         self._cwai.create_wc_ad_idea()
         self._cwai.get_idea_id()
     with step('新建落地页'):
         self._cqc = CreateQrCode()
         self._cqc.create_pay_qr_code()
         self._cqc.publish_website()
         self._cqc.create_link()
         #create_code()
     with step('落地页数据列表统计查询'):
         self._cqc.ldy_list_data_query()
     with step('入库记录流量数据查询'):
         self._prq = PutRecordQuery()
         self._prq.put_record_query()
     with step('广告创意流量数据查询'):
         self._cwai.ad_idea_flow_data_query()
 def test_linear_distributed_of_general(self):
     with allure.step('新建广告计划-微信'):
         self._cwap = CreateAdPlan()
         self._cwap.create_ad_plan()
     with allure.step('创建微信广告创意'):
         self._cwap.get_plan_id()
         self._cwai = CreateAdIdea()
         self._cwai.create_personal_wechat_ad_ideas()
         self._cwai.get_idea_id()
     with allure.step('新建落地页'):
         self._cqc = CreateQrCode()
         self._cqc.add_personal_code()
         self._cqc.publish_website()
         self._cqc.create_link(accountId="wx359bdedd5d18907a",
                               releaseChannel=3)
         # tools.create_code()
     with allure.step('落地页数据列表统计查询'):
         self._cqc.ldy_list_data_query()
     with allure.step('入库记录流量数据查询'):
         self._prq.put_record_query()
     with allure.step('广告创意流量数据查询'):
         self._cwai.ad_idea_flow_data_query()
Example #7
0
class TestCompanyWcFlow:
    def setup(self):
        self._cwp = CreateAdPlan()
        self._cwai = CreateAdIdea()
        self._cqc = CreateQrCode()
        self._prq = PutRecordQuery()
        GLOBAL_VAR['projectName'] = const.projectName
        GLOBAL_VAR['ideaName'] = const.ideaName

    @step('企业微信流量入库_直线下发,普通投放模式')
    @logger('case')
    def test_line_common(self):
        with step('创建微信计划'):
            self._cwp.create_ad_plan()
        with step('创建微信广告创意'):
            self._cwp.get_plan_id()
            self._cwai = CreateAdIdea()
            self._cwai.create_wc_ad_idea()
            self._cwai.get_idea_id()
        with step('新建落地页'):
            self._cqc = CreateQrCode()
            self._cqc.create_qr_code()
            self._cqc.publish_website()
            self._cqc.create_link()
            #create_code()
        with step('落地页数据列表统计查询'):
            self._cqc.ldy_list_data_query()
        with step('入库记录流量数据查询'):
            self._prq = PutRecordQuery()
            self._prq.put_record_query()
        with step('广告创意流量数据查询'):
            self._cwai.ad_idea_flow_data_query()

    @step('企业微信流量入库_手动分配,普通投放模式')
    @logger('case')
    def test_manual_common(self):
        with step('创建微信计划'):
            self._cwp.create_wc_ad_plan_for_hand()
            self._cwp.get_plan_id()
        with step('创建微信广告创意'):
            self._cwai.create_wc_ad_idea()
            self._cwai.get_idea_id()
        with step('新建落地页'):
            self._cqc.create_qr_code()
            self._cqc.publish_website()
            self._cqc.create_link()
            #create_code()
        with step('落地页数据列表统计查询'):
            self._cqc.ldy_list_data_query()
        with step('入库记录流量数据查询'):
            self._prq.put_record_query()
        with step('广告创意流量数据查询'):
            self._cwai.ad_idea_flow_data_query()

    @step('企业微信流量入库_直线下发,接待投放模式')
    @logger('case')
    def test_reception_common(self):
        with step('创建微信计划'):
            self._cwp.create_wc_ad_plan_for_reception()
            self._cwp.get_plan_id()
        with step('创建微信广告创意'):
            self._cwai = CreateAdIdea()
            self._cwai.create_wc_ad_idea()
            self._cwai.get_idea_id()
        with step('新建落地页'):
            self._cqc = CreateQrCode()
            self._cqc.create_qr_code()
            self._cqc.publish_website()
            self._cqc.create_link()
            #create_code()
        with step('落地页数据列表统计查询'):
            self._cqc.ldy_list_data_query()
        with step('入库记录流量数据查询'):
            self._prq = PutRecordQuery()
            self._prq.put_record_query()
        with step('广告创意流量数据查询'):
            self._cwai.ad_idea_flow_data_query()

    @step('企业微信流量入库_直线下发,高转vip课投放模式')
    @logger('case')
    def test_line_vip(self):
        with step('创建微信计划'):
            self._cwp.create_wc_ad_plan_for_model(put_model=3)
            self._cwp.get_plan_id()
        with step('创建微信广告创意'):
            self._cwai = CreateAdIdea()
            self._cwai.create_wc_ad_idea()
            self._cwai.get_idea_id()
        with step('新建落地页'):
            self._cqc = CreateQrCode()
            self._cqc.create_pay_qr_code()
            self._cqc.publish_website()
            self._cqc.create_link()
            #create_code()
        with step('落地页数据列表统计查询'):
            self._cqc.ldy_list_data_query()
        with step('入库记录流量数据查询'):
            self._prq = PutRecordQuery()
            self._prq.put_record_query()
        with step('广告创意流量数据查询'):
            self._cwai.ad_idea_flow_data_query()

    @step('企业微信流量入库_微信流量手动分配,小咖投放模式')
    @logger('case')
    def test_manual_xk(self):
        with step('创建微信计划'):
            self._cwp.create_wc_ad_plan_for_model()
            self._cwp.get_plan_id()
        with step('创建微信广告创意'):
            self._cwai = CreateAdIdea()
            self._cwai.create_wc_ad_idea()
            self._cwai.get_idea_id()
        with step('新建落地页'):
            self._cqc = CreateQrCode()
            self._cqc.create_pay_qr_code()
            self._cqc.publish_website()
            self._cqc.create_link()
            #create_code()
        with step('落地页数据列表统计查询'):
            self._cqc.ldy_list_data_query()
        with step('入库记录流量数据查询'):
            self._prq = PutRecordQuery()
            self._prq.put_record_query()
        with step('广告创意流量数据查询'):
            self._cwai.ad_idea_flow_data_query()


# if __name__ == '__main__':
#     import pytest
#     pytest.main([__file__])
 def __init__(self):
     self._data = get_data.get_yinhe_data(
         'tool_module/landing_page_with_api.yaml')
     self.cqc = CreateQrCode()
class LandingPageWithApi:
    def __init__(self):
        self._data = get_data.get_yinhe_data(
            'tool_module/landing_page_with_api.yaml')
        self.cqc = CreateQrCode()

    def save_page(self, type=1, **kwargs):
        """
        保存落地页
        :param type: 1.企业微信模式 2.企业微信模式-不带商品+ 3.一键提交模式
        """
        if int(type) < 4:
            mode = 'save_page{}'.format(str(type))
            data = self._data[mode]
            cotool.quick_request(data, **kwargs)

    def save_pag(self, type=1, **kwargs):
        """
        保存落地页
        :param type: 1.企业微信模式 2.企业微信模式-不带商品+ 3.一键提交模式
        """
        if int(type) < 4:
            mode = 'save_page{}'.format(str(type))
            data = self._data[mode]
            cotool.quick_rqt(data, **kwargs)

    def association_creativity(self, type=1):
        """
        创建链接
        :param type: 1.微信活码模式-直线下发 2.手动分配 3.直线下发
        """
        FollowReq = {
            "gatherType": 3,
            "isTest": 0,
            "receiveDeptIdChain": "",
            "receiveDeptName": ""
        }
        if type == 1:
            dic1 = {"allocInstType": 3, "gatherType": 3, "putMode": 1}
        elif type == 2:
            dic1 = {"allocInstType": 2, "gatherType": 1, "putMode": 3}
        elif type == 3:
            dic1 = {
                "allocInstType": 3,
                "gatherType": 1,
                "putMode": 3,
                'receiveDeptId': 14,
                'receiveDeptIdChain': "1001-2001-3007-14",
                'receiveDeptName': "wy测试部门"
            }
        FollowReq = dict(FollowReq, **dic1)
        accountId = 'wx359bdedd5d18907a'
        self.cqc.create_link(releaseChannel=3,
                             subjectId=280,
                             websiteLinkFollowReq=FollowReq,
                             accountId=accountId,
                             channelId=6,
                             subject='PHP')

    def association_crt(self, type=1):
        """
        创建链接
        :param type: 1.微信活码模式-直线下发 2.手动分配 3.直线下发
        """
        FollowReq = {
            "gatherType": 3,
            "isTest": 0,
            "receiveDeptIdChain": "",
            "receiveDeptName": ""
        }
        if type == 1:
            dic1 = {"allocInstType": 3, "gatherType": 3, "putMode": 1}
        elif type == 2:
            dic1 = {"allocInstType": 2, "gatherType": 1, "putMode": 3}
        elif type == 3:
            dic1 = {
                "allocInstType": 3,
                "gatherType": 1,
                "putMode": 3,
                'receiveDeptId': 14,
                'receiveDeptIdChain': "1001-2001-3007-14",
                'receiveDeptName': "wy测试部门"
            }
        FollowReq = dict(FollowReq, **dic1)
        accountId = 'wx359bdedd5d18907a'
        self.cqc.crt_link(releaseChannel=3,
                          subjectId=280,
                          websiteLinkFollowReq=FollowReq,
                          accountId=accountId,
                          channelId=6,
                          subject='PHP')
            "receiveDeptName": ""
        }
        if type == 1:
            dic1 = {"allocInstType": 3, "gatherType": 3, "putMode": 1}
        elif type == 2:
            dic1 = {"allocInstType": 2, "gatherType": 1, "putMode": 3}
        elif type == 3:
            dic1 = {
                "allocInstType": 3,
                "gatherType": 1,
                "putMode": 3,
                'receiveDeptId': 14,
                'receiveDeptIdChain': "1001-2001-3007-14",
                'receiveDeptName': "wy测试部门"
            }
        FollowReq = dict(FollowReq, **dic1)
        accountId = 'wx359bdedd5d18907a'
        self.cqc.crt_link(releaseChannel=3,
                          subjectId=280,
                          websiteLinkFollowReq=FollowReq,
                          accountId=accountId,
                          channelId=6,
                          subject='PHP')


if __name__ == '__main__':
    lpwa = LandingPageWithApi()
    lpwa.save_page()
    CreateQrCode().publish_website()
    lpwa.association_creativity(2)
class TestPersonalWechatScenario():
    def setup(self):
        self._cwap = CreateAdPlan()
        self._cwai = CreateAdIdea()
        self._cqc = CreateQrCode()
        self._prq = PutRecordQuery()
        GLOBAL_VAR['projectName'] = const.projectName

    @logger('case')
    @allure.step('个人微信流量入库_直线下发,普通投放模式')
    def test_linear_distributed_of_general(self):
        with allure.step('新建广告计划-微信'):
            self._cwap = CreateAdPlan()
            self._cwap.create_ad_plan()
        with allure.step('创建微信广告创意'):
            self._cwap.get_plan_id()
            self._cwai = CreateAdIdea()
            self._cwai.create_personal_wechat_ad_ideas()
            self._cwai.get_idea_id()
        with allure.step('新建落地页'):
            self._cqc = CreateQrCode()
            self._cqc.add_personal_code()
            self._cqc.publish_website()
            self._cqc.create_link(accountId="wx359bdedd5d18907a",
                                  releaseChannel=3)
            # tools.create_code()
        with allure.step('落地页数据列表统计查询'):
            self._cqc.ldy_list_data_query()
        with allure.step('入库记录流量数据查询'):
            self._prq.put_record_query()
        with allure.step('广告创意流量数据查询'):
            self._cwai.ad_idea_flow_data_query()

    @logger('case')
    @allure.step('个人微信流量入库_手动分配,普通投放模式')
    def test_manual_allocation_of_general(self):
        with allure.step('新建广告计划-微信'):
            self._cwap.create_wc_ad_plan_for_hand()
        with allure.step('创建微信广告创意'):
            self._cwap.get_plan_id()
            self._cwai.create_personal_wechat_ad_ideas()
            self._cwai.get_idea_id()
        with allure.step('新建落地页'):
            self._cqc.add_personal_code()
            self._cqc.publish_website()
            self._cqc.create_link(accountId="wx359bdedd5d18907a",
                                  releaseChannel=3)
            #tools.create_code()
        with allure.step('落地页数据列表统计查询'):
            self._cqc.ldy_list_data_query()
        with allure.step('入库记录流量数据查询'):
            self._prq.put_record_query()
        with allure.step('广告创意流量数据查询'):
            self._cwai.ad_idea_flow_data_query()

    @logger('case')
    @allure.step('个人微信流量入库_直线下发,接待投放模式')
    def test_linear_distributed_of_reception(self):
        with allure.step('新建广告计划-微信'):
            self._cwap.create_wc_ad_plan_for_reception()
        with allure.step('创建微信广告创意'):
            self._cwap.get_plan_id()
            self._cwai = CreateAdIdea()
            self._cwai.create_personal_wechat_ad_ideas()
            self._cwai.get_idea_id()
        with allure.step('新建落地页'):
            self._cqc.add_personal_code()
            self._cqc.publish_website()
            self._cqc.create_link(accountId="wx359bdedd5d18907a",
                                  releaseChannel=3)
            #tools.create_code()
        with allure.step('落地页数据列表统计查询'):
            self._cqc.ldy_list_data_query()
        with allure.step('入库记录流量数据查询'):
            self._prq.put_record_query()
        with allure.step('广告创意流量数据查询'):
            self._cwai.ad_idea_flow_data_query()

    @logger('case')
    @allure.step('个人微信流量入库_直线下发,高转vip课投放模式')
    def test_linear_distributed_of_vip(self):
        with allure.step('新建广告计划-微信'):
            self._cwap.create_ad_plan(putMode=3)
        with allure.step('创建微信广告创意'):
            self._cwap.get_plan_id()
            self._cwai = CreateAdIdea()
            self._cwai.create_personal_wechat_ad_ideas()
            self._cwai.get_idea_id()
        with allure.step('新建落地页'):
            self._cqc.add_personal_code()
            self._cqc.publish_website()
            self._cqc.create_link(accountId="wx359bdedd5d18907a",
                                  releaseChannel=3)
            #tools.create_code()
        with allure.step('落地页数据列表统计查询'):
            self._cqc.ldy_list_data_query()
        with allure.step('入库记录流量数据查询'):
            self._prq.put_record_query()
        with allure.step('广告创意流量数据查询'):
            self._cwai.ad_idea_flow_data_query()

    @logger('case')
    @allure.step('个人微信流量入库_微信流量手动分配,小咖投放模式')
    def test_linear_distributed_of_small_cafe(self):
        with allure.step('新建广告计划-微信'):
            self._cwap.create_wc_xiaoka_ad_plan()
        with allure.step('创建微信广告创意'):
            self._cwap.get_plan_id()
            self._cwai = CreateAdIdea()
            self._cwai.create_personal_wechat_ad_ideas()
            self._cwai.get_idea_id()
        with allure.step('新建落地页'):
            self._cqc.add_personal_code()
            self._cqc.publish_website()
            self._cqc.create_link(accountId="wx359bdedd5d18907a",
                                  releaseChannel=3)
            #tools.create_code()
        with allure.step('落地页数据列表统计查询'):
            self._cqc.ldy_list_data_query()
        with allure.step('入库记录流量数据查询'):
            self._prq.put_record_query()
        with allure.step('广告创意流量数据查询'):
            self._cwai.ad_idea_flow_data_query()
    def create_landing_page_api(self, api, goods_id=None):
        '''
        api获取广告方式创建落地页
        :param goods_id: 商品id
        :param api: 1:仅提交-不需要验证码-计划, 2:仅提交-需要验证码-计划, 3:仅提交-不需要验证码-手动,
                    4:仅提交-需要验证码-手动, 5:仅提交-不需要验证码-直线, 6:仅提交-需要验证码-直线, 7:一键提交-手动,
                    8:一键提交-直线, 9:企业微信, 10:先支付再企业微信
        :return:
        '''
        wb = Website()
        c = Check()
        lpw = LandingPageWithApi()
        cqc = CreateQrCode()
        if api == 1:
            wb.create_website_no(adCreateType=2, version=2.13)
            wb.publish_web()
            wb.association_crt_api(allocInstType=1)
            c.list_landing_pag()
        elif api == 2:
            wb.create_website_n(adCreateType=2, version=2.13)
            wb.publish_web()
            wb.association_crt_api(allocInstType=1)
            c.list_landing_pag()
        elif api == 3:
            wb.create_website_no(adCreateType=2, version=2.13)
            wb.publish_web()
            wb.association_crt_api(allocInstType=2, isTest=0)
            c.list_landing_pag()
        elif api == 4:
            wb.create_website_n(adCreateType=2, version=2.13)
            wb.publish_web()
            wb.association_crt_api(allocInstType=1)
            c.list_landing_pag()
        elif api == 5:
            wb.create_website_no(adCreateType=2, version=2.13)
            wb.publish_web()
            wb.association_crt_api(
                allocInstType=2,
                isTest=0,
                receiveDeptId=4572,
                receiveDeptIdChain='1001-2001-4569-4570-4571-4572',
                receiveDeptName='rm一院')
            c.list_landing_pag()
        elif api == 6:
            wb.create_website_n(adCreateType=2, version=2.13)
            wb.publish_web()
            wb.association_crt_api(
                allocInstType=2,
                isTest=0,
                receiveDeptId=4572,
                receiveDeptIdChain='1001-2001-4569-4570-4571-4572',
                receiveDeptName='rm一院')
            c.list_landing_pag()
        elif api == 7:
            lpw.save_pag(type=3, goodsId=goods_id)
            cqc.publish_web()
            lpw.association_crt(type=2)
            c.list_landing_pag_api()
        elif api == 8:
            lpw.save_pag(type=3, goodsId=goods_id)
            cqc.publish_web()
            lpw.association_crt(type=3)
            c.list_landing_pag_api()


# cqc = CrtLadingPage()
# cqc.create_landingpage_for_company_wc(ideas_id='113997')