예제 #1
0
    def test_playListerrorScreenCount(self):
        print("开始测试test_playListerrorScreenCount")
        # 执行接口查询
        self.res_date = set_dp_interface(url=queryentry_url +
                                         sspFinanceAnalysisPlayList,
                                         data=FinanceAnalysisPlayList_data)
        # print("接口返回结果:" + str(self.res_date))
        inf_errorScreenCount = self.res_date['data']

        # 执行SQL查询
        sql = "SELECT ssu.create_time, (SUM(DISTINCT ssu.screen_count) - SUM(DISTINCT spu.play_screens)) AS errorScreenCounts FROM screen_summary AS ssu LEFT JOIN ssp_play_summary AS spu ON ssu.create_time = spu.transaction_date WHERE	ssu.media_provider_id = {0} AND (ssu.create_time BETWEEN '{1}' AND  '{2}') GROUP BY create_time;".format(
            media_provider_id, startDate, endDate)
        print("数据库查询使用语句:" + sql)
        self.pymysqlcursor.execute(sql)
        sql_errorScreenCounts = self.pymysqlcursor.fetchall()

        print("异常屏对比")
        # for i in range(len(errorScreenCount)):
        #     statisGroup = errorScreenCount[i].get("statisGroup")
        #     inf_errorScreenCount = errorScreenCount[i].get("errorScreenCount")
        #     sql_errorScreenCount = sql_errorScreenCounts[i].get("errorScreenCounts")
        #     print('日期: {0}, 接口返回结果:{1} , 数据库查询结果:{2}' .format(statisGroup, inf_errorScreenCount,sql_errorScreenCount))
        # self.assertEqual(inf_errorScreenCount,sql_errorScreenCount,"test_playListerrorScreenCount,数据对不上" )
        statisDates = 'statisGroup'
        com_errorScreenCount = 'errorScreenCount'
        com_errorScreenCounts = 'errorScreenCounts'
        comparison_1(self, inf_errorScreenCount, sql_errorScreenCounts,
                     statisDates, com_errorScreenCount, com_errorScreenCounts)
예제 #2
0
    def test_playListrequestCount(self):
        print("开始测试test_playListrequestCount")
        # 执行接口查询
        self.res_date = set_dp_interface(url=queryentry_url +
                                         sspFinanceAnalysisPlayList,
                                         data=FinanceAnalysisPlayList_data)
        # print("接口返回结果:" + str(self.res_date))
        inf_requestCount = self.res_date['data']

        # 执行SQL查询
        sql = "SELECT transaction_date,SUM(request_times) AS request_times FROM	ssp_play_summary WHERE ssp_id = {0} AND transaction_date BETWEEN '{1}'AND '{2}' GROUP BY transaction_date;".format(
            media_provider_id, startDate, endDate)
        print("数据库查询使用语句:" + sql)
        self.pymysqlcursor.execute(sql)
        sql_request_times = self.pymysqlcursor.fetchall()

        print("请求广告次数对比")
        # for i in range(len(requestCount)):
        #     statisGroup = requestCount[i].get("statisGroup")
        #     inf_requestCount = requestCount[i].get("requestCount")
        #     sql_request_times = request_times[i].get("request_times")
        #     print('日期: {0}, 接口返回结果:{1} , 数据库查询结果:{2}' .format(statisGroup, inf_requestCount,sql_request_times))
        # self.assertEqual(inf_requestCount,sql_request_times,"test_playListrequestCount,数据对不上" )
        statisDates = 'statisGroup'
        com_requestCount = 'requestCount'
        com_request_times = 'request_times'
        comparison_1(self, inf_requestCount, sql_request_times, statisDates,
                     com_requestCount, com_request_times)
예제 #3
0
    def test_playListmaterialFailCount(self):
        print("开始测试test_playListmaterialFailCount")
        # 执行接口查询
        self.res_date = set_dp_interface(url=queryentry_url +
                                         sspFinanceAnalysisPlayList,
                                         data=FinanceAnalysisPlayList_data)
        # print("接口返回结果:" + str(self.res_date))
        inf_materialFailCount = self.res_date['data']

        # 执行SQL查询
        sql = "SELECT transaction_date,SUM(play_fail_times) AS play_fail_times FROM	ssp_play_summary WHERE ssp_id = {0} AND transaction_date BETWEEN '{1}'AND '{2}' GROUP BY transaction_date;".format(
            media_provider_id, startDate, endDate)
        print("数据库查询使用语句:" + sql)
        self.pymysqlcursor.execute(sql)
        sql_play_fail_times = self.pymysqlcursor.fetchall()

        print("播放异常对比")
        statisDates = 'statisGroup'
        com_materialFailCount = 'materialFailCount'
        com_play_fail_times = 'play_fail_times'
        comparison_1(self, inf_materialFailCount, sql_play_fail_times,
                     statisDates, com_materialFailCount, com_play_fail_times)