Пример #1
0
    def query_zt_info(self, isEnterpriseWx=0, **kwargs):
        '''
        查询载体信息
        :param isEnterpriseWx: 载体类型,0微信 1企业微信
        :param kwargs: 载体名称 vector=***
        :return:
        '''

        if isEnterpriseWx == 0:
            data = self._data.get('query_zt_info_for_person')
            url, method, header, params, shared, check = cotool.deal_data(data)
            params['isEnterpriseWx'] = isEnterpriseWx
            if kwargs:
                params = dict(params, **kwargs)
            res = httprequest(url, method, header, params)
            cotool.extract_variable(res, shared)
            cotool.assert_res(res, check)
            return res
        else:
            data = self._data.get('query_zt_info_for_company')
            url, method, header, params, shared, check = cotool.deal_data(data)
            params['isEnterpriseWx'] = isEnterpriseWx
            if kwargs:
                params = dict(params, **kwargs)
            res = httprequest(url, method, header, params)
            cotool.extract_variable(res, shared)
            cotool.assert_res(res, check)
            return res
Пример #2
0
 def editor_flow(self,
                 plan_name=None,
                 gather_type=1,
                 ad_type=1,
                 channel_id=4,
                 channel_name='知乎'):
     """
     广告计划--流量-编辑 (需要一个没有创建创意的计划才能编辑)
     :param plan_name: 计划名称
     :param channel_name: 投放渠道名称,要与下面channel_ID对应
     :param channel_id: 投放渠道 1,广点通 2,今日头条 3,哔哩哔哩 4,知乎 5,微博...
     :param ad_type: 广告类型,1,信息流 2,竞价
     :param gather_type: 1,手机流量 2,qq流量 3,微信流量
     :return:
     """
     data = self._data.get('editor_flow')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['name'] = plan_name
     params['id'] = GLOBAL_VAR['adId']
     params['gatherType'] = gather_type
     params['channelId'] = channel_id
     params['type'] = ad_type
     params['channelName'] = channel_name
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Пример #3
0
 def delete_carrier(self, id):
     data = self._data.get('delete_carrier')
     url, method, header, params, shared, check = cotool.deal_data(data)
     url = url + str(id)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Пример #4
0
 def import_wx_flow_free(self,
                         token=None,
                         type=1,
                         subject_id=280,
                         subject_name='PHP'):
     """
     学员录入--导入(微信流量)--拥有【免费流量组】
     """
     if type == 1:
         data = self._data.get('student_input_import_for_wx_free')
     else:
         data = self._data.get('student_input_import_for_wx_free_perssion')
     url, method, header, params, shared, check = cotool.deal_data(data)
     excel = {
         "1": ['客户姓名', '手机号码', 'QQ号码', '微信号', 'QQ群'],
         "2": ['lily', '13012345678', '23121231', '123456', '123456']
     }
     if token is None:
         if rc.get_env() == 'pre':
             token = login.login_action('t0322511032')
         else:
             token = login.login_action('m17673155297')
     file_data, content_type, file_path = oe.send_file(excel, params)
     header['content-type'] = content_type
     header['token'] = token
     params['subjectId'] = subject_id
     params['subjectName'] = subject_name
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     oe.delete(file_path)
Пример #5
0
 def create_wc_ad_plan_for_model(self, put_model=1, channelId=4):
     data = self._data.get('create_wechat_ad_plant')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['putMode'] = put_model
     params['channelId'] = channelId
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
 def publish_web(self):
     """
     发布落地页
     """
     data = self._data.get('publish_website')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     return res
Пример #7
0
 def put_record_query(self):
     """
     入库记录流量数据查询
     """
     data = self._data.get('query_put_flow_data')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
 def ldy_list_data_query(self):
     """
     落地页数据列表统计查询
     """
     data = self._data.get('query_ldy_data')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     return res
Пример #9
0
 def ad_idea_flow_data_query(self):
     """
     广告创意流量数据查询
     """
     data = self._data.get('query_ad_ideas_data')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Пример #10
0
 def create_personal_wechat_ad_ideas(self):
     """
     创建个人微信广告创意
     """
     data = self._data.get('create_personal_wechat_ad_ideas')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Пример #11
0
 def create_wc_ad_plan_for_reception(self):
     """
     创建微信广告计划-直线下发,接待投放模式
     """
     data = self._data.get('create_wechat_ad_plant_for_reception')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Пример #12
0
 def test_traffic_type_data_view(self):
     login.login('m15656900011', '123456')
     self._data = get_data.get_yunyi_data('trafficTypeDataView.yaml')
     data = self._data.get('traffic_typ_dataview')
     url, method, header, params, sql, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     result = eq.query(sql)
     for i in range(len(result)):
         check['rows'][i]['flowNum'] = result[i]['apply_num']
     cotool.assert_list(res, check, 'rows')
Пример #13
0
 def login_operation(self):
     '''
     登录运营后台
     '''
     url, method, header, params, shared, check = cotool.deal_data(
         self._data['login_operation'])
     header['cookie'] = self.cookie
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Пример #14
0
 def import_budget_error_data(self, file_name):
     '''
     导入异常投放预算数据
     '''
     data = self._data.get('import_budget_error_data')
     url, method, header, params, shared, check = cotool.deal_data(data)
     file_data, content_type, file_path = oe.send_others_file(file_name, params)
     header['content-type'] = content_type
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Пример #15
0
 def test_refund(self, caseid, desc, precondition, parameterize, url,
                 method, header, data, shared, check):
     log.info("CaseId: <- {} ->".format(caseid))
     log.info("Desc: {}".format(desc))
     header = cotool().set_header(header)
     params = cotool().set_params(parameterize, data)
     res = httprequest(url, method, header, params)
     if shared:
         cotool.extract_variable(res, shared)
     cotool().assert_res(res, check)
     allure.dynamic.story("CaseID: < {} > - {}".format(caseid, desc))
Пример #16
0
 def add_personal_code_for_tools(self, **kwargs):
     """
     生成个人微信二维码,发布(工具使用)
     """
     data = self._data.get('add_personal_code_for_tools')
     url, method, header, params, shared, check = cotool.deal_data(data)
     if kwargs:
         params = dict(params, **kwargs)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     return res
Пример #17
0
 def create_qq_idea(self):
     '''
     创建QQ广告创意
     :return:
     '''
     data = self._data.get('create_qq_ad_ideas')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Пример #18
0
 def register_code(self):
     '''
     获取注册验证码
     '''
     self.login_operation()
     url, method, header, params, shared, check = cotool.deal_data(
         self._data['register_code'])
     header['cookie'] = self.cookie
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Пример #19
0
 def get_plan_id(self, gatherType=3):
     """
     获取微信广告计划ID
     """
     data = self._data.get('get_plan_id')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['gatherType'] = gatherType
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Пример #20
0
 def del_ad_data(self, gatherType=1):
     '''
     删除广告数据
     :return:
     '''
     data = self._data.get('del_ad_data')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['gatherType'] = gatherType
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Пример #21
0
 def add_ad_plan(self):
     '''
     创建广告计划
     :return:
     '''
     data = self._cad.get('program_info_save')
     url, method, header, params, shared, check = cotool.deal_data(data)
     token = login.login_action('t0383212689', '123456')
     header['token'] = token
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Пример #22
0
 def creativity_pageList(self):
     '''
     广告创意查询
     :return:
     '''
     data = self._cct.get('creativity_pageList')
     url, method, header, params, shared, check = cotool.deal_data(data)
     token = login.login_action('t0383212689', '123456')
     header['token'] = token
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Пример #23
0
 def test_traffic_trend_group_date_view(self):
     '''
     每日流量申请机构分组统计
     :return:
     '''
     login.login('m15656900011', '123456')
     self._data = get_data.get_yunyi_data('trafficTypeDataView.yaml')
     data = self._data.get('traffic_trend_group_dataview')
     url, method, header, params, sql, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     result = eq.query(sql)
     check['orgList'] = result
     cotool.assert_list(res, check, 'orgList')
Пример #24
0
 def import_wx_batch_reception(self, excel):
     '''
     批量导入微信广告流量数据,接待投放模式
     :return:
     '''
     data = self._data['import_wx_batch_reception']
     url, method, header, params, shared, check = cotool.deal_data(data)
     file_data, content_type, file_path = oe.send_file(excel, params)
     header['content-type'] = content_type
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     oe.delete(file_path)
Пример #25
0
 def import_qq_single(self, excel):
     '''
     导入qq单个广告流量数据
     :return:
     '''
     data = self._data['import_qq_single']
     url, method, header, params, shared, check = cotool.deal_data(data)
     file_data, content_type, file_path = oe.send_file(excel, params)
     header['content-type'] = content_type
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     oe.delete(file_path)
Пример #26
0
 def export_idea_flow(self, gather_type=1):
     """
     广告计划--流量-导出
     :param gather_type: 1,手机流量 2,qq流量 3,微信流量
     :return:
     """
     data = self._data.get('export_idea_flow')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['gatherType'] = gather_type
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Пример #27
0
 def create_ad_idea(self, gatherType=1):
     '''
     创建广告创意
     :param gatherType: 流量类型 1,手机流量 2,QQ流量 3,微信流量
     :return:
     '''
     data = self._data.get('create_ad_ideas')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['gatherType'] = gatherType
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Пример #28
0
 def flow_cost_mgt_import(self, excel):
     """
     :param excel: excel文件头组成的list
     :return:
     """
     data = self._data.get('flow_cost_mgt_import')
     url, method, header, params, shared, check = cotool.deal_data(data)
     file_data, content_type, file_path = oe.send_file(excel, params)
     header['content-type'] = content_type
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     oe.delete(file_path)
Пример #29
0
 def create_wc_ad_idea_for_tools(self, vector=None, isEnterpriseWx=0):
     '''
     创建微信广告创意(工具使用方法)
     :param vector: 载体名称
     :param isEnterpriseWx: 微信/企业微信   0,微信   1,企业微信
     :return:
     '''
     if vector is not None:
         self.query_zt_info(isEnterpriseWx=isEnterpriseWx, vector=vector)
     if isEnterpriseWx == 0:
         data = self._data.get('create_person_wc_ad_ideas')
         url, method, header, params, shared, check = cotool.deal_data(data)
         params['vector'] = GLOBAL_VAR['carrierNo']
         params['receiveDeptId'] = GLOBAL_VAR['belongDepartmentId']
         params['followerTanzkAccount'] = GLOBAL_VAR['followTzAccount']
         params['receiveDeptName'] = GLOBAL_VAR['receiveDeptName']
         params['vectorId'] = GLOBAL_VAR['zt_id']
         params['vectorName'] = GLOBAL_VAR['carrierName']
         params['programId'] = GLOBAL_VAR['adId']
         params['programName'] = GLOBAL_VAR['adName']
         res = httprequest(url, method, header, params)
         cotool.extract_variable(res, shared)
         return res
     else:
         data = self._data.get('create_wc_ad_ideas')
         url, method, header, params, shared, check = cotool.deal_data(data)
         params['vector'] = GLOBAL_VAR['carrierNo']
         params['receiveDeptId'] = GLOBAL_VAR['belongDepartmentId']
         params['followerTanzkAccount'] = GLOBAL_VAR['followTzAccount']
         params['receiveDeptName'] = GLOBAL_VAR['receiveDeptName']
         params['companyWechatId'] = GLOBAL_VAR['companyWechatId']
         params['vectorId'] = GLOBAL_VAR['zt_id']
         params['vectorName'] = GLOBAL_VAR['carrierName']
         params['programId'] = GLOBAL_VAR['adId']
         params['programName'] = GLOBAL_VAR['adName']
         res = httprequest(url, method, header, params)
         cotool.extract_variable(res, shared)
         return res
Пример #30
0
 def send_consumer_single(self):
     '''
     录入手机单个广告消费数据接口
     :return:
     '''
     data = self._data['import_consumer_single']
     url, method, header, params, shared, check = cotool.deal_data(data)
     token = login.login_action('t0383212689', '123456')
     header['token'] = token
     params['costDate'] = const.todayStartTimestamp
     # res = requests.post(url=url, headers=headers_from_data, data=file_data, verify=False).json()
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)