Exemplo n.º 1
0
    def test_002_register_time_all(self):
        """用户管理-搜索注册时间-全部"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_list', 2, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_list', 2, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = 'select count(*) from users'
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
Exemplo n.º 2
0
    def test_011_authType_infoFilled(self):
        """用户管理-认证状态-已填写资料"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_list', 11, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_list', 11, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select count(*) from users_auth where is_real_name = 2"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
Exemplo n.º 3
0
    def test_004_billingMode_CPA(self):
        """推广-渠道管理-计价方式-按激活收费(CPA)"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'channel_list', 4, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'channel_list', 4, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "SELECT COUNT(id) FROM company WHERE billing_mode = 'CPA'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["UserSum"], dbo[0])
    def test_001_search_imageName(self):
        """运营-广告管理-广告名称搜索"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'sysproduct_image', 1, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'sysproduct_image', 1, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select count(id) from images where title = '今日推荐'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
Exemplo n.º 5
0
    def test_015_register_method(self):
        """用户-用户管理:注册方式-H5"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_list', 12, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_list', 12, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "SELECT COUNT(*) FROM `users` WHERE register_app = 5"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
    def test_004_newsType_jieKuanJiQiao(self):
        """运营-文章列表-文章分类-借款技巧"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'news_news_list', 4, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'news_news_list', 4, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "SELECT COUNT(id) FROM dc_news WHERE news_type = '借款技巧'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
Exemplo n.º 7
0
    def test_008_search_source(self):
        """用户管理—搜索渠道"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_list', 8, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_list', 8, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select count(*) from users where out_put_source = '电销5'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
Exemplo n.º 8
0
    def test_001_userInfo(self):
        """用户-查看用户详情-【查看】按钮userinfo"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo', 1, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo', 1, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select coalesce(out_put_source, market_source) from users where id='1008623658'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["List"]["MarketSource"], dbo[0])
    def test_004_state_processed(self):
        """意见反馈-处理状态-已处理"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_feedback', 4, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_feedback', 4, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select count(*) from feedback where feedback_type != '待处理'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
Exemplo n.º 10
0
    def test_002_userInformation_oldUsers(self):
        """用户-查看用户详情-老用户(已填写基础信息)"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo', 2, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo', 2, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select id_no from users_info where account='18768124236'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["RealNameInfo"]["IdNo"], dbo[0])
    def test_008_imgType_welcomePage(self):
        """运营-广告管理-位置-首页"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'sysproduct_image', 8, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'sysproduct_image', 8, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "SELECT COUNT(id) FROM images WHERE img_type = 2"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
Exemplo n.º 12
0
    def test_002_addRecommend_add(self):
        """运营-推荐位管理-点击添加按钮"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'sysproduct_down_list', 2, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'sysproduct_down_list', 2,
                             6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "SELECT COUNT(id) FROM product_h5 WHERE is_used = 'USE'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(len(result["Result"]), dbo[0])
Exemplo n.º 13
0
    def test_012_search_userName(self):
        """用户管理-搜索姓名"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_list', 12, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_list', 12, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select uid from users_info where id_name = '刘斐汝'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], 1)
        self.assertEqual(result["Result"]["List"][0]["Id"], str(dbo[0]))
Exemplo n.º 14
0
    def test_011_userInfo_black_add_delete(self):
        """用户-用户管理-黑名单-注册时间-删除黑名单"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_black_list', 11, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_black_list', 11,
                             6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "SELECT remark FROM users_black WHERE account = '18768124236'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertIsNone(dbo)
Exemplo n.º 15
0
    def test_001_summary_detail_default(self):
        """推广-渠道数据-每日汇总-默认页面"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'channel_summary_details', 1, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'channel_summary_details', 1,
                             6).get_body()

        payloads.update(StartDate=settings.str_thirtyDays,
                        EndDate=settings.str_today)

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        # 验证接口返回状态码
        self.assertEqual(res, 200)
Exemplo n.º 16
0
    def test_010_surplus_temporaryunuse(self):
        """运营-H5产品-单日剩余投放数-无剩余"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'sysproduct_get_product_h5', 10,
                        3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'sysproduct_get_product_h5', 10,
                             6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        # sql = "select count(*) from product_h5 where max_amount >= 200000"
        # dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
Exemplo n.º 17
0
    def test_008_userInfo_loginHistory(self):
        """用户-查看用户详情-查看-登录历史"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo', 8, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo', 8, 6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql1 = "SELECT COUNT(*) FROM login_record WHERE uid = 1008624327"
        sql2 = "SELECT create_time, stage, ip_address FROM login_record WHERE uid = 1008624327 ORDER BY create_time DESC LIMIT 1"
        dbo1 = DbOperate(sql1).db_operate()
        dbo2 = DbOperate(sql2).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo1[0])
        self.assertEqual(result["Result"]["List"][0]["CreateTime"], dbo2[0])

        # 判断stage
        stage_dict = {
            "login": "******",
            "fastlogin": "******",
            "silentlogin": "******",
            "register": "注册"
        }
        # print(stage_dict[dbo2[1]])
        self.assertEqual(result["Result"]["List"][0]["Stage"],
                         stage_dict[dbo2[1]])

        # 判段数据库搜索结果是否为空
        if dbo2[2] != None:
            self.assertEqual(result["Result"]["List"][0]["IpAddress"], dbo2[2])
        else:
            pass
Exemplo n.º 18
0
    def test_004_amount_Under_5000(self):
        """运营-H5产品-可借金额-5000以内"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'sysproduct_get_product_h5', 4,
                        3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'sysproduct_get_product_h5', 4,
                             6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select count(*) from product_h5 where max_amount > 0 and max_amount <= 5000"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["ProductH5ListCount"], dbo[0])
    def test_004_search_endTime(self):
        """运营-广告管理-时间-只输入结束时间"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'sysproduct_image', 4, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'sysproduct_image', 4, 6).get_body()

        payloads.update(EndDate=settings.str_aMonthAge)

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "SELECT COUNT(id) FROM images WHERE end_time <= '" + settings.str_aMonthAge + "'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
Exemplo n.º 20
0
    def test_012_isUsed_unused(self):
        """运营-H5产品-状态-结束"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'sysproduct_get_product_h5', 12,
                        3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'sysproduct_get_product_h5', 12,
                             6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select count(*) from product_h5 where is_used = 'UNUSED'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["ProductH5ListCount"], dbo[0])
Exemplo n.º 21
0
    def test_009_platform_summary_by_register_time(self):
        """运营-H5数据-平台汇总-1个月、按注册日期统计"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'sysproduct_h5_date_detail', 9, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'sysproduct_h5_date_detail', 9, 6).get_body()

        payloads.update(StartDate=settings.str_aMonthAge, EndDate=settings.str_today)

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug('是测试点"%s"下的用例"%s",返回的结果res=%s]' % (
            self.__class__.__name__, getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "SELECT SUM(pv1), SUM(pv2), SUM(register_count) FROM record_product_by_register_time WHERE register_date = '"+settings.str_today+"'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"][0]["Pv1"], dbo[0])
        self.assertEqual(result["Result"][0]["Pv2"], dbo[1])
        self.assertEqual(result["Result"][0]["Pv2"], dbo[2])
Exemplo n.º 22
0
    def test_004_addRecommend_delete(self):
        """运营-推荐位管理-删除"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'sysproduct_down_list', 4, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'sysproduct_down_list', 4,
                             6).get_body()

        # 通过pid获取down_list的id
        sql = "SELECT id FROM down_list WHERE pid = '357'"
        dbo = DbOperate(sql).db_operate()
        payloads.update(Id=str(dbo[0]))

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        self.assertEqual(res, 200)
    def test_003_search_product_H5(self):
        """申请记录-H5产品"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_record_product_h5', 3,
                        3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_record_product_h5', 3,
                             6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select count(*) from record_product_h5 where product_id = (select id from product_h5 where mechanism = '51人品贷')"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
    def test_002_search_mobile(self):
        """意见反馈-搜索手机号"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_feedback', 2, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_feedback', 2, 6).get_body()
        # 获取日期并加入payloads
        payloads.update(EndDate=settings.str_today,
                        StartDate=settings.str_sevenDays)

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select count(*) from feedback where uid=(select id from users where account='18768124236')"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
    def test_001_search_default(self):
        """运营-文章列表-默认搜索(创建时间:今天-前一个月)"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'news_news_list', 1, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'news_news_list', 1, 6).get_body()

        payloads.update(StartDate=settings.str_aMonthAge,
                        EndDate=settings.str_today)

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "SELECT COUNT(id) FROM dc_news WHERE create_time between '" + settings.str_aMonthAge + "' and '" + settings.str_today + "'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
    def test_001_search_sevenDays(self):
        """短信记录-默认搜索7天"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        # 读取token.yaml中的token值
        Token = read_token.re_token()

        # 读取testcase_data.xlsx中的url与请求参数
        url = ReadExcel(EXCEL_PATH, 'userinfo_usermessage', 1, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_usermessage', 1, 6).get_body()

        today = datetime.date.today()
        sevenDays = today - datetime.timedelta(days=6)
        str_today = str(today)
        str_sevenDays = str(sevenDays)
        # 修改payloads中对应key的value值
        payloads.update(EndDate=str_today, StartDate=str_sevenDays)

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug('是测试点"%s"下的用例"%s",返回的结果res=%s]' % (
            self.__class__.__name__, getattr(self, self.get_current_function_name()).__doc__, res))

        self.assertEqual(res, 200)
    def test_017_register_source(self):
        """用户-申请记录:注册渠道-电销5"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_record_product_h5', 16,
                        3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_record_product_h5', 16,
                             6).get_body()
        payloads.update(RegisterStartDate=settings.str_nineDays,
                        RegisterEndDate=settings.str_eightDays)

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "SELECT COUNT(rp.id) FROM users u LEFT JOIN record_product_h5 rp ON u.id=rp.uid WHERE u.out_put_source = '电销5'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        self.assertEqual(result["Result"]["UserSum"], dbo[0])
Exemplo n.º 28
0
    def test_001_userInfo_black_list_default(self):
        """用户-用户管理-黑名单-默认页面(注册时间:全部)"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_black_list', 1, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_black_list', 1,
                             6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select count(*) from users_black"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        if dbo != None:
            self.assertEqual(result["Result"]["UserSum"], dbo[0])
        else:
            pass
Exemplo n.º 29
0
    def test_002_userInfo_black_list_search_account(self):
        """用户-用户管理-黑名单-手机号搜索"""
        logger.logger.logger.debug('当前方法:%s' % p.get_current_function_name())
        Token = read_token.re_token()

        url = ReadExcel(EXCEL_PATH, 'userinfo_black_list', 2, 3).get_url()
        payloads = ReadExcel(EXCEL_PATH, 'userinfo_black_list', 2,
                             6).get_body()

        result = post_request(url, payloads, Token)
        res = result["Ret"]
        logger.logger.logger.debug(
            '是测试点"%s"下的用例"%s",返回的结果res=%s]' %
            (self.__class__.__name__,
             getattr(self, self.get_current_function_name()).__doc__, res))

        sql = "select uid from users_black where account = '15968856860'"
        dbo = DbOperate(sql).db_operate()

        self.assertEqual(res, 200)
        if dbo != None:
            self.assertEqual(result["Result"]["List"][0]["Uid"], dbo[0])
        else:
            pass