Beispiel #1
0
    def test_watcher(self):
        #登录
        login_perf = requests.post(host + "/dev/appgw/userlogin?",
                                   data=common_function.login_data(
                                       "e10adc3949ba59abbe56e057f20f883e",
                                       13340962953),
                                   verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_perf.text)
        #提取主播的易播号name
        perf_name = str(re.findall(r"name(.+?)nickname",
                                   login_perf.text))[5:-5]
        print("perf_name:", perf_name)
        #获取sessionid
        sessionid_perf = str(re.findall(r"sessionid(.+?)auth",
                                        login_perf.text))[5:-5]
        print("performer sessionid:", sessionid_perf)
        #获取主播饭团数
        get_riceroll0 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        self.assertIn("ok", get_riceroll0.text)
        riceroll0 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll0.text))[4:-4])
        print("riceroll0", riceroll0)

        #观众登录
        login_watcher = requests.post(host + "/dev/appgw/userlogin?",
                                      data=common_function.login_data(
                                          "e10adc3949ba59abbe56e057f20f883e",
                                          18639658074),
                                      verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_watcher.text)
        #获取sessionid
        sessionid_watcher = str(
            re.findall(r"sessionid(.+?)auth", login_watcher.text))[5:-5]
        print("watcher sessionid:", sessionid_watcher)

        #新分类列表
        topiclistnew = requests.get(
            host + "/dev/appgw/topiclistnew?count=10000&start=0&sessionid=" +
            sessionid_perf,
            verify=False)
        self.assertIn("ok", topiclistnew.text)
        #准备直播,获取vid
        prepare = requests.get(
            host + "/dev/appgw/liveprepare?switch=false&sessionid=" +
            sessionid_perf,
            verify=False)
        self.assertIn("ok", prepare.text)
        #提取返回内容中的vid
        vid = str(re.findall(r"vid(.+?)live_url", prepare.text))[5:-5]
        print("vid:", vid)

        #获取用户财产信息
        asset1 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                              sessionid_perf,
                              verify=False)
        self.assertIn("ok", asset1.text)
        #获取管理员列表
        usermanagerlist = requests.get(
            host + "/dev/appgw/usermanagerlist?sessionid=" + sessionid_perf,
            verify=False)
        self.assertIn("ok", usermanagerlist.text)
        #获取用户财产信息
        asset2 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                              sessionid_perf,
                              verify=False)
        self.assertIn("ok", asset2.text)
        #获取游戏列表
        getgamelist = requests.get(host + "/dev/appgw/getgamelist?sessionid=" +
                                   sessionid_perf,
                                   verify=False)
        self.assertIn("ok", getgamelist.text)
        #用户基本信息
        userbaseinfo = requests.get(host + "/dev/appgw/userbaseinfo?name=" +
                                    perf_name + "&sessionid=" + sessionid_perf,
                                    verify=False)
        self.assertIn("ok", userbaseinfo.text)
        #获取用户财产信息
        asset3 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                              sessionid_perf,
                              verify=False)
        self.assertIn("ok", asset3.text)
        #获取用户背包道具
        userpackagetools = requests.get(
            host +
            "/dev/appgw/userpackagetools?&start=0&count=100000&sessionid=" +
            sessionid_perf,
            verify=False)
        self.assertIn("ok", userpackagetools.text)
        #获取贵族信息
        noble_data = {"sessionid": sessionid_perf}
        getnobleinfo = requests.post(host + "/dev/appgw/getnobleinfo?",
                                     data=noble_data,
                                     verify=False)
        self.assertIn("ok", getnobleinfo.text)
        #获取直播间任务
        taskinlive = requests.get(host + "/dev/appgw/taskinlive?&anchor_uid=" +
                                  perf_name + "&sessionid=" + sessionid_perf,
                                  verify=False)
        self.assertIn("ok", taskinlive.text)

        #开启直播
        livestart = requests.get(
            host + "/dev/appgw/livestart?vid=" + vid +
            "&quality=normal&permission=0&thumb=0&sessionid=" +
            sessionid_perf +
            "&title=performer%E5%B8%A6%E4%BD%A0%E8%BA%AB%E4%B8%B4%E5%85%B6%E5%A2%83%EF%BC%8C%E4%B8%8D%E5%AE%B9%E9%94%99%E8%BF%87&gps_latitude=30.542094&mode=0&gps=1&accompany=0&nettype=wifi&gps_longitude=104.061429&cp=V0_P1_S0_E1_R1_B0_A0_CN_M0",
            verify=False)
        self.assertIn("ok", livestart.text)
        #直播心跳
        getstatus0 = requests.get(
            "http://123.57.240.208:3100/getstatus?gid=-1&vid=" + vid +
            "&sid=" + sessionid_perf + "&hid=-1&lt=0&cid=0&aid=0&cnt=0")
        self.assertIn("ok", getstatus0.text)
        #上传可视云
        #clientcounter=requests.get("http://videodev.ksyun.com/univ/clientcounter?accesskey=D8uDWZ88ZKW48/eZHmRm&expire="+str(int(time.time()))+"&cont=eyJzZGtfdHlwZSI6InN0cmVhbWVyIiwic2RrX3ZlciI6IjUuMC4xLjMiLCJwbGF0Zm9ybSI6ImFuZHJvaWQiLCJvc192ZXIiOiI2LjAiLCJwa2ciOiJjb20uY2N2aWRlbyIsImRldl9tb2RlbCI6IkhVQVdFSSBWTlMtQUwwMCIsImRldl9pZCI6Ijg2MzI5MzAzOTM4MTc3NCIsImxvZ192ZXIiOiIyLjAuMSIsImxvZ192biI6MTAyfQ%3D%3D&uniqname=ksystreamer_android&signature=NhNJ7G1wz8IcJ26aOzZ2sMGzy9o%3D")
        #self.assertIn("success",clientcounter.text)
        #获取本地dns
        getlocaldns = requests.get("http://trace-ldns.ksyun.com/getlocaldns")
        self.assertIn("ClientIP", getlocaldns.text)
        print("getlocaldns:", getlocaldns.text)
        #获取

        #主播发红包
        creatredpack = requests.get(
            host + "/dev/appgw/pay/createredpack?count=20&vid=" + vid +
            "&sessionid=" + sessionid_perf +
            "&title=%E6%81%AD%E5%96%9C%E5%8F%91%E8%B4%A2%EF%BC%8C%E5%A4%A7%E5%90%89%E5%A4%A7%E5%88%A9%EF%BC%81&ecoin=50",
            verify=False)
        print("creatredpack:", creatredpack.text)
        #获取红包信息
        for i in range(0, 3):
            getredpackinfo = requests.get(
                "http://123.57.240.208:3100/getstatus?gid=0&vid=" + vid +
                "&sid=" + sessionid_perf + "&hid=1&lt=" +
                str(int(time.time())) + "&cid=0&aid=0&cnt=0")
            print(i, "getredpackinfo:", getredpackinfo.text)
Beispiel #2
0
    def test_watcher(self):
        #登录
        login_perf = requests.post(host + "/dev/appgw/userlogin?",
                                   data=common_function.login_data(
                                       "e10adc3949ba59abbe56e057f20f883e",
                                       13399887766),
                                   verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_perf.text)
        #提取主播的易播号name
        perf_name = str(re.findall(r"name(.+?)nickname",
                                   login_perf.text))[5:-5]
        print("perf_name:", perf_name)
        #获取sessionid
        sessionid_perf = str(re.findall(r"sessionid(.+?)auth",
                                        login_perf.text))[5:-5]
        print("performer sessionid:", sessionid_perf)
        #获取主播饭团数
        get_riceroll0 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        self.assertIn("ok", get_riceroll0.text)
        riceroll0 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll0.text))[4:-4])
        print("riceroll0", riceroll0)

        #观众登录
        login_watcher = requests.post(host + "/dev/appgw/userlogin?",
                                      data=common_function.login_data(
                                          "e10adc3949ba59abbe56e057f20f883e",
                                          13399778866),
                                      verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_watcher.text)
        #获取sessionid
        sessionid_watcher = str(
            re.findall(r"sessionid(.+?)auth", login_watcher.text))[5:-5]
        print("watcher sessionid:", sessionid_watcher)

        #进入空房间

        join_emptyroom = requests.get(
            host +
            "/dev/appgw/joinroom?gps_longitude=104.060612&gps_latitude=30.542042&sessionid="
            + sessionid_watcher + "&room=" + perf_name,
            verify=False)
        self.assertIn("ok", join_emptyroom.text)

        #赠送礼物:么么哒*1
        send_Agift01 = requests.post(host + "/dev/appgw/pay/buy?",
                                     data=common_function.gift_data(
                                         1, perf_name, perf_name, 332,
                                         sessionid_watcher),
                                     verify=False)
        self.assertIn("ok", send_Agift01.text)
        #获取饭团数
        get_riceroll1 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        riceroll1 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll1.text))[4:-4])
        self.assertTrue(riceroll1 > riceroll0)

        #赠送幸运礼物:幸运1黑丝*1
        send_Bgift01 = requests.post(host + "/dev/appgw/pay/buy?",
                                     data=common_function.gift_data(
                                         1, perf_name, perf_name, 309,
                                         sessionid_watcher),
                                     verify=False)
        self.assertIn("ok", send_Bgift01.text)
        #获取饭团数
        get_riceroll2 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        riceroll2 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll2.text))[4:-4])
        self.assertTrue(riceroll2 > riceroll1)

        #赠送钻石礼物:10钻石礼物*1
        send_Cgift01 = requests.post(host + "/dev/appgw/pay/buy?",
                                     data=common_function.gift_data(
                                         1, perf_name, perf_name, 308,
                                         sessionid_watcher),
                                     verify=False)
        self.assertIn("ok", send_Cgift01.text)
        #获取饭团数
        get_riceroll3 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        riceroll3 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll3.text))[4:-4])
        self.assertTrue(riceroll3 > riceroll2)

        #赠送普通礼物*2
        send_Agift02 = requests.post(host + "/dev/appgw/pay/buy?",
                                     data=common_function.gift_data(
                                         2, perf_name, perf_name, 332,
                                         sessionid_watcher),
                                     verify=False)
        self.assertIn("ok", send_Agift02.text)
        #获取饭团数
        get_riceroll4 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        riceroll4 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll4.text))[4:-4])
        self.assertTrue(riceroll4 > riceroll3)

        #赠送幸运礼物:幸运1黑丝*520
        send_Bgift02 = requests.post(host + "/dev/appgw/pay/buy?",
                                     data=common_function.gift_data(
                                         520, perf_name, perf_name, 309,
                                         sessionid_watcher),
                                     verify=False)
        self.assertIn("ok", send_Bgift02.text)
        #获取饭团数
        get_riceroll5 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        riceroll5 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll5.text))[4:-4])
        self.assertTrue(riceroll5 > riceroll4)

        #赠送钻石礼物:10钻石礼物*9
        send_Cgift02 = requests.post(host + "/dev/appgw/pay/buy?",
                                     data=common_function.gift_data(
                                         9, perf_name, perf_name, 308,
                                         sessionid_watcher),
                                     verify=False)
        self.assertIn("ok", send_Cgift02.text)
        #获取饭团数
        get_riceroll6 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        riceroll6 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll6.text))[4:-4])
        self.assertTrue(riceroll6 > riceroll5)

        #随机赠送任意数量、任一礼物*3次
        for i in range(0, 2):
            gifts = ["308", "309", "332", "307", "311", "334"]
            gift_data = {
                "number": random.randint(1, 20),
                "name": perf_name,
                "vid": perf_name,
                "goodsid": int(random.choice(gifts)),
                "sessionid": sessionid_watcher
            }
            send_gift = requests.post(host + "/dev/appgw/pay/buy?",
                                      data=gift_data,
                                      verify=False)
            self.assertIn("ok", send_gift.text)
            #获取饭团数
            get_riceroll7 = requests.get(
                host + "/dev/appgw/pay/asset?sessionid=" + sessionid_perf,
                verify=False)
            riceroll7 = int(
                str(re.findall(r"riceroll(.+?)limitcash",
                               get_riceroll7.text))[4:-4])
            self.assertTrue(riceroll7 > riceroll6)
            print("这是第", i + 1, "次")

        #获取贵族信息
        get_noble = requests.post(
            host + "/dev/appgw/getnobleinfo?",
            data=common_function.headers(sessionid_watcher),
            verify=False)
        noble1 = re.findall(r'"noble_list":(.+?)}}', get_noble.text)
        print("get_nolble:", noble1)
        #截取noble_level
        noble_level = re.findall(
            r":(.+?),", str(re.findall(r"noble_level(.+?)name", str(noble1))))
        print("noble_level:", noble_level)
        #截取开通贵族价值易币
        noble_ecoin = re.findall(
            r":(.+?),", str(re.findall(r"ecoin(.+?)rebate_ecoin",
                                       str(noble1))))
        print("noble_ecoin: ", noble_ecoin)
        #截取返回易币
        retbate_coin = re.findall(
            r":(.+?),",
            str(re.findall(r"rebate_ecoin(.+?)image_id", str(noble1))))
        print("retbate_coin:", retbate_coin)

        #开通贵族
        level = random.randint(0, len(noble_level) - 1)
        buy_noble = requests.post(host + "/dev/appgw/buynoble?",
                                  data=common_function.buynoble(
                                      noble_level[level], noble_ecoin[level],
                                      retbate_coin[level], 0, perf_name,
                                      sessionid_watcher),
                                  verify=False)
        self.assertIn("ok", buy_noble.text)
        #贵族续费
        noble_continue = requests.post(host + "/dev/appgw/buynoble?",
                                       data=common_function.buynoble(
                                           noble_level[level],
                                           noble_ecoin[level],
                                           retbate_coin[level], 0, perf_name,
                                           sessionid_watcher),
                                       verify=False)
        self.assertIn("ok", noble_continue.text)
        #贵族自动续费
        noble_auto_continue = requests.post(host + "/dev/appgw/buynoble?",
                                            data=common_function.buynoble(
                                                noble_level[level],
                                                noble_ecoin[level],
                                                retbate_coin[level], 1,
                                                perf_name, sessionid_watcher),
                                            verify=False)
        self.assertIn("ok", noble_auto_continue.text)
        #获取专属礼物
        getparamnew = requests.get(
            host + "/dev/appgw/getparamnew?devtype=android&sessionid=" +
            sessionid_watcher,
            verify=False)
        #获取第一个位置的专属礼物id和对应等级
        #noblegift= common_function.get_noblegift_id(getparamnew)
        #print("noblegift_id",noblegift,int(noblegift[1]))
        #gift_position=int(noblegift[1])-1
        #print("position",gift_position)
        #获取第一个位置的专属礼物id和对应等级
        noblegift = common_function.get_noblegift_id(getparamnew)
        print("noblegift_id", noblegift[0], int(str(noblegift[1])[:-10]))
        gift_position = noble_level.index(str(noblegift[1])[:-10])
        print("position", gift_position)
        #购买第一个贵族专属礼物对应的等级
        #开通贵族
        buy_noble = requests.post(host + "/dev/appgw/buynoble?",
                                  data=common_function.buynoble(
                                      noble_level[gift_position],
                                      noble_ecoin[gift_position],
                                      retbate_coin[gift_position], 0,
                                      perf_name, sessionid_watcher),
                                  verify=False)
        self.assertIn("ok", buy_noble.text)
        #赠送贵族专属礼物
        print(
            common_function.gift_data(1, perf_name, perf_name, noblegift[0],
                                      sessionid_watcher))
        noble_gift = requests.post(host + "/dev/appgw/pay/buy?",
                                   data=common_function.gift_data(
                                       1, perf_name, perf_name, noblegift[0],
                                       sessionid_watcher),
                                   verify=False)
        self.assertIn("ok", noble_gift.text)
        #获取饭团数
        get_riceroll8 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        riceroll8 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll8.text))[4:-4])
        self.assertTrue(riceroll8 > riceroll7)

        ###商城###

        #获取商城电子券列表
        get_e_coupon_list = requests.get(
            host + "/wgl/shop/goodslist?sessionid=" + sessionid_watcher +
            "&type=2&number_type=1&goods_type=2,5&start=0&count=6",
            verify=False)
        self.assertIn("ok", get_e_coupon_list.text)
        #用正则筛选各类信息
        e_coupon_info = common_function.get_goodsinfo(get_e_coupon_list)
        #商品数量
        e_coupon__num = e_coupon_info[-1]
        #购买电子券商品,2代表电子券
        #获取商品数量最多的
        max_num = str(max(map(int, e_coupon__num)))
        if int(max_num) > 0:
            #判断数量最多的位置
            e_coupon__position = e_coupon__num.index(max_num)
            #购买电子券
            e_shopping = requests.post(
                host + "/wgl/shop/goodsbuy",
                data=common_function.shopping(
                    sessionid_watcher, 2, e_coupon_info[0][e_coupon__position],
                    e_coupon_info[3][e_coupon__position],
                    e_coupon_info[2][e_coupon__position],
                    e_coupon_info[4][e_coupon__position],
                    e_coupon_info[1][e_coupon__position], 1),
                verify=False)
            #判断返回接口内容
            self.assertIn("ok", e_shopping.text)
            print(e_shopping.content.decode("unicode_escape"))
        else:
            print(r"商城没有可购买的电子券")

        #购买认证
        #获取认证商品列表
        get_authen_list = requests.get(
            host + "/wgl/shop/goodslist?sessionid=" + sessionid_watcher +
            "&type=2&number_type=1&goods_type=3&start=0&count=6",
            verify=False)
        print(get_authen_list.text)
        authen_info = common_function.get_goodsinfo(get_authen_list)
        authen_num = authen_info[-1]
        print(len(authen_info), authen_info)
        #获取商品数量最多的
        max_num1 = str(max(map(int, authen_num)))
        print(max_num1)
        if int(max_num1) > 0:
            #最大值的位置
            authen_position = authen_num.index(max_num1)
            #购买认证
            authen_shopping = requests.post(
                host + "/wgl/shop/goodsbuy",
                data=common_function.shopping(sessionid_watcher, 2,
                                              authen_info[0][authen_position],
                                              authen_info[3][authen_position],
                                              authen_info[2][authen_position],
                                              authen_info[4][authen_position],
                                              authen_info[1][authen_position],
                                              1),
                verify=False)
            #判断返回内容
            self.assertIn("ok", authen_shopping.text)
            #打印返回后的内容
            print(authen_shopping.content.decode("unicode_escape"))
        else:
            print(r"商城没有可购买的认证")

        #购买座驾
        #获取座驾靓号商品列表
        seat_list = requests.get(
            host + "/wgl/shop/goodslist?sessionid=" + sessionid_watcher +
            "&type=2&number_type=2&goods_type=4&start=0&count=6",
            verify=False)
        print(seat_list.text)
        seat_info = common_function.get_goodsinfo(seat_list)
        seat_num = seat_info[-1]
        print(len(seat_info), seat_num)
        #获取商品数量最多的
        max_num4 = str(max(map(int, seat_num)))
        print(max_num4)
        if int(max_num4) > 0:
            #最大值的位置
            seat_position = seat_num.index(max_num4)
            #购买生日靓号
            seat_shopping = requests.post(host + "/wgl/shop/goodsbuy",
                                          data=common_function.shopping(
                                              sessionid_watcher, 2,
                                              authen_info[0][seat_position],
                                              authen_info[3][seat_position],
                                              authen_info[2][seat_position],
                                              authen_info[4][seat_position],
                                              authen_info[1][seat_position],
                                              1),
                                          verify=False)
            #判断返回内容
            self.assertIn("ok", seat_shopping.text)
            #打印返回后的内容
            print(r"座驾购买:", seat_shopping.content.decode("unicode_escape"))
        else:
            print(r"商城没有可购买的座驾")

        #购买8位靓号
        #获取8位靓号的礼物信息
        get_eightnumber_list = requests.get(
            host + "/wgl/shop/goodslist?sessionid=" + sessionid_watcher +
            "&type=1&number_type=1&goods_type=0&start=0&count=6",
            verify=False)
        self.assertIn("ok", get_eightnumber_list.text)
        #提取id和type
        eightnumber_info = common_function.get_number(get_eightnumber_list)
        #购买8位靓号
        buy_eightnumber = requests.post(host + "/wgl/shop/goodsbuy",
                                        data=common_function.buy_number(
                                            sessionid_watcher,
                                            eightnumber_info[1][0][:-1],
                                            eightnumber_info[0][0]),
                                        verify=False)
        self.assertIn("ok", buy_eightnumber.text)

        #购买生日靓号
        #获取生日靓号信息
        get_birth_list = requests.get(
            host + "/wgl/shop/goodslist?sessionid=" + sessionid_watcher +
            "&type=1&number_type=2&goods_type=0&start=0&count=6",
            verify=False)
        print(get_birth_list.text)
        #提取id和type
        birth_info = common_function.get_number(get_birth_list)
        #购买生日靓号
        buy_eightnumber = requests.post(host + "/wgl/shop/goodsbuy",
                                        data=common_function.buy_number(
                                            sessionid_watcher,
                                            birth_info[1][0][:-1],
                                            birth_info[0][0]),
                                        verify=False)
        self.assertIn("ok", buy_eightnumber.text)
        '''
Beispiel #3
0
    def _test_shopping(self):
        #登录
        login_perf = requests.post(host + "/dev/appgw/userlogin?",
                                   data=common_function.login_data(
                                       "e10adc3949ba59abbe56e057f20f883e",
                                       13399887766),
                                   verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_perf.text)
        #提取主播的易播号name
        perf_name = str(re.findall(r"name(.+?)nickname",
                                   login_perf.text))[5:-5]
        print("perf_name:", perf_name)
        #获取sessionid
        sessionid_perf = str(re.findall(r"sessionid(.+?)auth",
                                        login_perf.text))[5:-5]
        print("performer sessionid:", sessionid_perf)
        #获取主播饭团数
        get_riceroll0 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        self.assertIn("ok", get_riceroll0.text)
        riceroll0 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll0.text))[4:-4])
        print("riceroll0", riceroll0)

        #观众登录
        login_watcher = requests.post(host + "/dev/appgw/userlogin?",
                                      data=common_function.login_data(
                                          "e10adc3949ba59abbe56e057f20f883e",
                                          13399778866),
                                      verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_watcher.text)
        #提取观看端的易播号name
        watcher_name = str(re.findall(r"name(.+?)nickname",
                                      login_watcher.text))[5:-5]
        print("watcher_name:", watcher_name)
        #获取sessionid
        sessionid_watcher = str(
            re.findall(r"sessionid(.+?)auth", login_watcher.text))[5:-5]
        print("watcher sessionid:", sessionid_watcher)

        #送背包礼物(考虑观影券问题)
        #获取背包礼物信息
        get_package_info = requests.get(
            host +
            "/dev/appgw/userpackagetools?&start=0&count=100000&sessionid=" +
            sessionid_watcher,
            verify=False)
        self.assertIn("ok", get_package_info.text)
        #获取礼物名称
        package_list = get_package_info.content.decode("unicode_escape")
        print(package_list)
        #获取背包道具的type和tool_id
        packagegoods_info = common_function.get_packagegoods_info(
            get_package_info)
        #判断是否存在可赠送礼物type为1
        if '1' in packagegoods_info[0]:
            print("背包存在可赠送礼物")
            bag_position = packagegoods_info[0].index('1')
            print("bag_position", bag_position)
            tool_id = packagegoods_info[1][bag_position]
            #赠送背包道具
            send_pag_gift = requests.get(
                host + "/dev/appgw/usepackagetool?&number=1&touser="******"&vid=" + perf_name + "&usetype=1&toolid=" +
                tool_id + "&sessionid=" + sessionid_watcher,
                verify=False)
            print(send_pag_gift.content.decode("unicode_escape"))
            self.assertIn("ok", send_pag_gift.text)
            #获取饭团数
            get_riceroll1 = requests.get(
                host + "/dev/appgw/pay/asset?sessionid=" + sessionid_perf,
                verify=False)
            riceroll1 = int(
                str(re.findall(r"riceroll(.+?)limitcash",
                               get_riceroll1.text))[4:-4])
            self.assertTrue(riceroll1 > riceroll0)
        else:
            print("背包没有可赠送礼物")

        #转赠礼物
        gift_giving = requests.get(
            host + "/dev/appgw/usepackagetool?&toolid=" +
            packagegoods_info[1][0] + "&usetype=2&vid=" + perf_name +
            "&number=1&touser="******"&sessionid=" +
            sessionid_watcher,
            verify=False)
        self.assertIn("ok", gift_giving.text)

        #购买/续费默默守护
        buy_momo = requests.get(host + "/dev/appgw/pay/buyguardian?vid=" +
                                perf_name + "&guardianid=1&to_user="******"&sessionid=" + sessionid_watcher,
                                verify=False)
        self.assertIn("ok", buy_momo.text)
        #购买/续费一生守护
        buy_alive = requests.get(host + "/dev/appgw/pay/buyguardian?vid=" +
                                 perf_name + "&guardianid=2&to_user="******"&sessionid=" + sessionid_watcher,
                                 verify=False)
        self.assertIn("ok", buy_alive.text)
        #购买/续费珍爱守护
        buy_love = requests.get(host + "/dev/appgw/pay/buyguardian?vid=" +
                                perf_name + "&guardianid=3&to_user="******"&sessionid=" + sessionid_watcher,
                                verify=False)
        self.assertIn("ok", buy_love.text)

        #弹幕
        bulletscreen = requests.get(host + "/dev/appgw/bulletscreen?content=" +
                                    "asd" + "&vid=" + perf_name +
                                    "&sessionid=" + sessionid_watcher,
                                    verify=False)
        self.assertIn("ok", bulletscreen.text)
Beispiel #4
0
    def test_freelive_shopping(self):
        #登录
        login_perf = requests.post(host + "/dev/appgw/userlogin?",
                                   data=common_function.login_data(
                                       "e10adc3949ba59abbe56e057f20f883e",
                                       13399887766),
                                   verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_perf.text)
        #提取主播的易播号name
        perf_name = str(re.findall(r"name(.+?)nickname",
                                   login_perf.text))[5:-5]
        print("perf_name:", perf_name)
        #获取sessionid
        sessionid_perf = str(re.findall(r"sessionid(.+?)auth",
                                        login_perf.text))[5:-5]
        print("performer sessionid:", sessionid_perf)
        #获取主播饭团数
        get_riceroll0 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        self.assertIn("ok", get_riceroll0.text)
        riceroll0 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll0.text))[4:-4])
        print("riceroll0", riceroll0)

        #观众登录
        login_watcher = requests.post(host + "/dev/appgw/userlogin?",
                                      data=common_function.login_data(
                                          "e10adc3949ba59abbe56e057f20f883e",
                                          13399778866),
                                      verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_watcher.text)
        #提取观看端的易播号name
        watcher_name = str(re.findall(r"name(.+?)nickname",
                                      login_watcher.text))[5:-5]
        print("watcher_name:", watcher_name)
        #获取sessionid
        sessionid_watcher = str(
            re.findall(r"sessionid(.+?)auth", login_watcher.text))[5:-5]
        print("watcher sessionid:", sessionid_watcher)

        #准备直播,获取vid
        prepare = requests.get(
            host + "/dev/appgw/liveprepare?switch=false&sessionid=" +
            sessionid_perf,
            verify=False)
        self.assertIn("ok", prepare.text)
        #提取返回内容中的vid
        vid = str(re.findall(r"vid(.+?)live_url", prepare.text))[5:-5]
        print("vid:", vid)
        #开启直播
        livestart = requests.get(
            host + "/dev/appgw/livestart?vid=" + vid +
            "&quality=normal&permission=0&thumb=0&sessionid=" +
            sessionid_perf +
            "&title=performer%E5%B8%A6%E4%BD%A0%E8%BA%AB%E4%B8%B4%E5%85%B6%E5%A2%83%EF%BC%8C%E4%B8%8D%E5%AE%B9%E9%94%99%E8%BF%87&gps_latitude=30.542094&mode=0&gps=1&accompany=0&nettype=wifi&gps_longitude=104.061429&cp=V0_P1_S0_E1_R1_B0_A0_CN_M0",
            verify=False)
        self.assertIn("ok", livestart.text)

        #普通单抽
        #普通十连抽

        #高级单抽
        get_high_one = requests.get(
            host + "/dev/agservice/admin/superlottery?vid=" + vid +
            "&sessionid=" + sessionid_watcher + "&number=1",
            verify=False)
        self.assertIn("ok", get_high_one.text)
        #高级十连抽
        get_high_ten = requests.get(
            host + "/dev/agservice/admin/superlottery?vid=" + vid +
            "&sessionid=" + sessionid_watcher + "&number=10",
            verify=False)
        self.assertIn("ok", get_high_ten.text)
        #高级百连抽
        get_high_ten = requests.get(
            host + "/dev/agservice/admin/superlottery?vid=" + vid +
            "&sessionid=" + sessionid_watcher + "&number=100",
            verify=False)
        self.assertIn("ok", get_high_ten.text)
        #送背包礼物(考虑观影券问题)
        #获取背包礼物信息
        get_package_info = requests.get(
            host +
            "/dev/appgw/userpackagetools?&start=0&count=100000&sessionid=" +
            sessionid_watcher,
            verify=False)
        self.assertIn("ok", get_package_info.text)
        #获取礼物名称
        package_list = get_package_info.content.decode("unicode_escape")
        print(package_list)
        #获取背包道具的type和tool_id
        packagegoods_info = common_function.get_packagegoods_info(
            get_package_info)
        #判断是否存在可赠送礼物type为1
        if '1' in packagegoods_info[0]:
            print("背包存在可赠送礼物")
            bag_position = packagegoods_info[0].index('1')
            print("bag_position", bag_position)
            tool_id = packagegoods_info[1][bag_position]
            #赠送背包道具
            send_pag_gift = requests.get(
                host + "/dev/appgw/usepackagetool?&number=1&touser="******"&vid=" + vid + "&usetype=1&toolid=" + tool_id +
                "&sessionid=" + sessionid_watcher,
                verify=False)
            print(send_pag_gift.content.decode("unicode_escape"))
            self.assertIn("ok", send_pag_gift.text)
            #获取饭团数
            get_riceroll1 = requests.get(
                host + "/dev/appgw/pay/asset?sessionid=" + sessionid_perf,
                verify=False)
            riceroll1 = int(
                str(re.findall(r"riceroll(.+?)limitcash",
                               get_riceroll1.text))[4:-4])
            self.assertTrue(riceroll1 > riceroll0)
        else:
            print("背包没有可赠送礼物")

        #转赠礼物
        gift_giving = requests.get(
            host + "/dev/appgw/usepackagetool?&toolid=" +
            packagegoods_info[1][0] + "&usetype=2&vid=" + vid +
            "&number=1&touser="******"&sessionid=" +
            sessionid_watcher,
            verify=False)
        self.assertIn("ok", gift_giving.text)

        #购买/续费默默守护
        buy_momo = requests.get(host + "/dev/appgw/pay/buyguardian?vid=" +
                                vid + "&guardianid=1&to_user="******"&sessionid=" + sessionid_watcher,
                                verify=False)
        self.assertIn("ok", buy_momo.text)
        #购买/续费一生守护
        buy_alive = requests.get(host + "/dev/appgw/pay/buyguardian?vid=" +
                                 vid + "&guardianid=2&to_user="******"&sessionid=" + sessionid_watcher,
                                 verify=False)
        self.assertIn("ok", buy_alive.text)
        #购买/续费珍爱守护
        buy_love = requests.get(host + "/dev/appgw/pay/buyguardian?vid=" +
                                vid + "&guardianid=3&to_user="******"&sessionid=" + sessionid_watcher,
                                verify=False)
        self.assertIn("ok", buy_love.text)

        #抢座
        grab_seat = requests.get(host + "/dev/appgw/grabseat?name=" +
                                 perf_name + "&vid=" + vid + "&sessionid=" +
                                 sessionid_watcher + "&level=1&ecoin=100",
                                 verify=False)
        self.assertIn("ok", grab_seat.text)
        #弹幕
        bulletscreen = requests.get(host + "/dev/appgw/bulletscreen?content=" +
                                    "asd" + "&vid=" + vid + "&sessionid=" +
                                    sessionid_watcher,
                                    verify=False)
        self.assertIn("ok", bulletscreen.text)

        #主播开启秘聊接单
        anchorstartsolo = requests.get(
            host + "/dev/appgw/anchorstartsolo?type=2&price=10&sessionid=" +
            sessionid_perf,
            verify=False)
        self.assertIn("ok", anchorstartsolo.text)
        print("anchorstartsolo:", anchorstartsolo.text)
        solo_id = str(
            re.findall(r"solo_id(.+?)channel_id", anchorstartsolo.text))[4:-4]
        #主播端心跳
        anchorsoloheartbt = requests.get(
            host + "/dev/appgw/anchorsoloheartbt?sessionid=" + sessionid_perf,
            verify=False)
        self.assertIn("ok", anchorsoloheartbt.text)
        #客户端发起秘聊申请
        usercallsolo = requests.get(host + "/dev/appgw/usercallsolo?solo_id=" +
                                    solo_id + "&sessionid=" +
                                    sessionid_watcher,
                                    verify=False)
        self.assertIn("ok", usercallsolo.text)
        print("usercallsolo:", usercallsolo.text)
        #客户端心跳
        usersoloheartbt = requests.get(
            host + "/dev/appgw/usersoloheartbt?sessionid=" + sessionid_watcher,
            verify=False)
        self.assertIn("ok", usersoloheartbt.text)
        #主播端结束直播
        livestop = requests.get(host + "/dev/appgw/livestop?vid=" + vid +
                                "&sessionid=" + sessionid_perf,
                                verify=False)
        self.assertIn("ok", livestop.text)
        #主播端接受秘聊
        anchoracceptsolo = requests.get(
            host + "/dev/appgw/anchoracceptsolo?accept=1&username="******"&sessionid=" + sessionid_perf,
            verify=False)
        self.assertIn("ok", anchoracceptsolo.text)
        print("anchoracceptsolo:", anchoracceptsolo.text)
        #主播端心跳
        anchorsoloheartbt = requests.get(
            host + "/dev/appgw/anchorsoloheartbt?sessionid=" + sessionid_perf,
            verify=False)
        self.assertIn("ok", anchorsoloheartbt.text)
        #客户端心跳
        usersoloheartbt = requests.get(
            host + "/dev/appgw/usersoloheartbt?sessionid=" + sessionid_watcher,
            verify=False)
        self.assertIn("ok", usersoloheartbt.text)
        #客户端退出秘聊
        stopsolo = requests.get(host + "/dev/appgw/stopsolo?sessionid=" +
                                sessionid_watcher,
                                verify=False)
        #self.assertIn("ok",stopsolo.text)
        print("stopsolo:", stopsolo.text)
Beispiel #5
0
    def test_freelive_performer(self):
        #登录
        login_perf = requests.post(host + "/dev/appgw/userlogin?",
                                   data=common_function.login_data(
                                       "e10adc3949ba59abbe56e057f20f883e",
                                       13399887766),
                                   verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_perf.text)
        #提取主播的易播号name
        perf_name = str(re.findall(r"name(.+?)nickname",
                                   login_perf.text))[5:-5]
        print("perf_name:", perf_name)
        #获取sessionid
        sessionid_perf = str(re.findall(r"sessionid(.+?)auth",
                                        login_perf.text))[5:-5]
        print("performer sessionid:", sessionid_perf)

        #观众登录
        login_watcher = requests.post(host + "/dev/appgw/userlogin?",
                                      data=common_function.login_data(
                                          "e10adc3949ba59abbe56e057f20f883e",
                                          13399778866),
                                      verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_watcher.text)
        #提取观看端的易播号name
        watcher_name = str(re.findall(r"name(.+?)nickname",
                                      login_watcher.text))[5:-5]
        print("watcher_name:", watcher_name)
        #获取sessionid
        sessionid_watcher = str(
            re.findall(r"sessionid(.+?)auth", login_watcher.text))[5:-5]
        print("watcher sessionid:", sessionid_watcher)

        #准备直播,获取vid
        prepare = requests.get(
            host + "/dev/appgw/liveprepare?switch=false&sessionid=" +
            sessionid_perf,
            verify=False)
        self.assertIn("ok", prepare.text)
        #提取返回内容中的vid
        vid = str(re.findall(r"vid(.+?)live_url", prepare.text))[5:-5]
        print("vid:", vid)
        #开启直播
        livestart = requests.get(
            host + "/dev/appgw/livestart?vid=" + vid +
            "&quality=normal&permission=0&thumb=0&sessionid=" +
            sessionid_perf +
            "&title=performer%E5%B8%A6%E4%BD%A0%E8%BA%AB%E4%B8%B4%E5%85%B6%E5%A2%83%EF%BC%8C%E4%B8%8D%E5%AE%B9%E9%94%99%E8%BF%87&gps_latitude=30.542094&mode=0&gps=1&accompany=0&nettype=wifi&gps_longitude=104.061429&cp=V0_P1_S0_E1_R1_B0_A0_CN_M0",
            verify=False)
        self.assertIn("ok", livestart.text)

        #主播发红包
        createredpack = requests.get(
            host + "/dev/appgw/pay/createredpack?count=10&vid=" + vid +
            "&sessionid=" + sessionid_perf +
            "&title=%E6%81%AD%E5%96%9C%E5%8F%91%E8%B4%A2%EF%BC%8C%E5%A4%A7%E5%90%89%E5%A4%A7%E5%88%A9%EF%BC%81&ecoin=20",
            verify=False)
        self.assertIn("ok", createredpack.text)
        print(createredpack.text)
        #从系统消息中找到红包消息
        #get_redpack_info=requests.get("http://123.57.240.208:3100/getstatus?gid=0&vid="+vid+"&sid=rDg2T6VDLQMjTrUgjbHVEJlLjReNxKuk&hid=475&lt=1561357084&cid=0&aid=37&cnt=0")
        #print(get_redpack_info.text)
        #pack_code=str(re.findall(r'hb(.+?)hnm',get_redpack_info.text))
        #print("pack_code",pack_code)
        #客户端打开红包
        #redpack=requests.get(host+"/dev/appgw/pay/redpack?vid="+vid+"&code=dqssmvmg"+pack_code+"esox0040xmty10&sessionid="+sessionid_watcher,verify=False)
        #print(redpack.text)

        #主播发送弹幕
        perf_bulletscreen = requests.get(
            host + "/dev/appgw/bulletscreen?content=" + "asd" + "&vid=" + vid +
            "&sessionid=" + sessionid_perf,
            verify=False)
        self.assertIn("ok", perf_bulletscreen.text)
    def test_payreplay_watcher(self):
        #登录
        login_perf=requests.post(host +"/dev/appgw/userlogin?", data=common_function.login_data("e10adc3949ba59abbe56e057f20f883e", 13399887766), verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok",login_perf.text)
        #提取主播的易播号name
        perf_name=str(re.findall(r"name(.+?)nickname",login_perf.text))[5:-5]
        print("perf_name:",perf_name)
        #获取sessionid
        sessionid_perf=str(re.findall(r"sessionid(.+?)auth",login_perf.text))[5:-5]
        print("performer sessionid:",sessionid_perf)
        #获取主播饭团数
        get_riceroll0=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",get_riceroll0.text)
        riceroll0=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll0.text))[4:-4])
        print("主播饭团数:",riceroll0)

        #观众登录
        login_watcher=requests.post(host +"/dev/appgw/userlogin?", data=common_function.login_data("e10adc3949ba59abbe56e057f20f883e", 13399778866), verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok",login_watcher.text)
        #获取sessionid
        sessionid_watcher=str(re.findall(r"sessionid(.+?)auth",login_watcher.text))[5:-5]
        print("watcher sessionid:",sessionid_watcher)

        #回放
        get_replay=requests.get(host+"/dev/appgw/topicvideolist?live=0&count=20&start=0&sessionid="+sessionid_watcher+"&topicid=213",verify=False)
        print(get_replay.content.decode("unicode-escape"))
        #筛选permission=7即付费视频
        permission7=re.findall(r'"permission":(.+?),"topic_video_id"',get_replay.text)
        print("permission7:",permission7)
        #筛选vid
        vids=re.findall(r'"vid":"(.+?)","living_status"',get_replay.text)
        print("vids:",vids)
        if '7' in permission7:
            print(u"当前回放视频存在付费视频")
            #获取付费回放视频的位置
            payreplay_position=permission7.index('7')
            print("payreplay_position:",payreplay_position)
            vid=vids[payreplay_position]
            #进入付费视频
            watchprepare=requests.get(host+"/dev/appgw/watchprepare?gps_longitude=104.060634&gps_latitude=30.542032&vid="+vids[payreplay_position]+"&sessionid="+sessionid_watcher,verify=False)
            print(watchprepare.text)
            #获取进入付费视频接口返回的retval值,如果是E_PAYMENT就是未支付费用
            payment=re.findall(r'"payment":(.+?),"price"',watchprepare.text)
            print(str(payment))
            #获取当前付费视频的价格
            price=re.findall(r'"price":(.+?),"owner"',watchprepare.text)
            print(price)
            if str(payment)=="['false']":
                print(u"当前付费视频需要付费")
                #支付观看付费视频所需易币
                livepay=requests.get(host+"/dev/appgw/livepay?gps_longitude=104.060634&gps_latitude=30.542032&vid="+vids[payreplay_position]+"&sessionid="+sessionid_watcher,verify=False)
                self.assertIn("ok",livepay.text)
                #观看直播
                watchstart=requests.get(host+"/dev/appgw/watchstart?gps_longitude=104.060634&vid="+vids[payreplay_position]+"&sessionid="+sessionid_watcher+"&gps_latitude=30.542032",verify=False)
                self.assertIn("ok",watchstart.text)
                #
            else:
                print(u"当前付费视频不需要付费")
                #跳过付费直接观看付费视频
                skippay_watchstart=requests.get(host+"/dev/appgw/watchstart?gps_longitude=104.060634&vid="+vids[payreplay_position]+"&sessionid="+sessionid_watcher+"&gps_latitude=30.542032",verify=False)
                self.assertIn("ok",skippay_watchstart.text)
            #当前已进入付费视频
            print(u"当前已进入付费视频")

            #赠送礼物:么么哒*1
            send_Agift01=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(1, perf_name, vid, 332, sessionid_watcher), verify=False)
            self.assertIn("ok",send_Agift01.text)
            #获取饭团数
            get_riceroll1=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
            riceroll1=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll1.text))[4:-4])
            self.assertTrue(riceroll1>riceroll0)
            #赠送幸运礼物:幸运1黑丝*1
            send_Bgift01=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(1, perf_name, vid, 309, sessionid_watcher), verify=False)
            self.assertIn("ok",send_Bgift01.text)
            #获取饭团数
            get_riceroll2=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
            riceroll2=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll2.text))[4:-4])
            self.assertTrue(riceroll2>riceroll1)
            #赠送钻石礼物:10钻石礼物*1
            send_Cgift01=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(1, perf_name, vid, 308, sessionid_watcher), verify=False)
            self.assertIn("ok",send_Cgift01.text)
            #获取饭团数
            get_riceroll3=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
            riceroll3=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll3.text))[4:-4])
            self.assertTrue(riceroll3>riceroll2)
            #赠送普通礼物*2
            send_Agift02=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(2, perf_name, vid, 332, sessionid_watcher), verify=False)
            self.assertIn("ok",send_Agift02.text)
            #获取饭团数
            get_riceroll4=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
            riceroll4=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll4.text))[4:-4])
            self.assertTrue(riceroll4>riceroll3)
            #赠送幸运礼物:幸运1黑丝*520
            send_Bgift02=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(520, perf_name, vid, 309, sessionid_watcher), verify=False)
            self.assertIn("ok",send_Bgift02.text)
            #获取饭团数
            get_riceroll5=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
            riceroll5=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll5.text))[4:-4])
            self.assertTrue(riceroll5>riceroll4)
            #赠送钻石礼物:10钻石礼物*9
            send_Cgift02=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(9, perf_name, vid, 308, sessionid_watcher), verify=False)
            self.assertIn("ok",send_Cgift02.text)
            #获取饭团数
            get_riceroll6=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
            riceroll6=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll6.text))[4:-4])
            self.assertTrue(riceroll6>riceroll5)
            #随机赠送任意数量、任一礼物*3次
            for i in range(0,2):
                gifts=["308","309","332","307","311","334"]
                gift_data={
                    "number":random.randint(1,20),
                    "name":perf_name,
                    "vid":vid,
                    "goodsid":int(random.choice(gifts)),
                    "sessionid":sessionid_watcher
                }
                send_gift=requests.post(host+"/dev/appgw/pay/buy?",data=gift_data,verify=False)
                self.assertIn("ok",send_gift.text)
                #获取饭团数
                get_riceroll7=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
                riceroll7=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll7.text))[4:-4])
                self.assertTrue(riceroll7>riceroll6)
                print("这是第",i+1,"次")
                #获取贵族信息
                get_noble=requests.post(host +"/dev/appgw/getnobleinfo?", data=common_function.headers(sessionid_watcher), verify=False)
                noble1=re.findall(r'"noble_list":(.+?)}}',get_noble.text)
                print("get_nolble:",noble1)
                #截取noble_level
                noble_level=re.findall(r":(.+?),",str(re.findall(r"noble_level(.+?)name",str(noble1))))
                print("noble_level:",noble_level)
                #截取开通贵族价值易币
                noble_ecoin=re.findall(r":(.+?),",str(re.findall(r"ecoin(.+?)rebate_ecoin",str(noble1))))
                print("noble_ecoin: ",noble_ecoin)
                #截取返回易币
                retbate_coin=re.findall(r":(.+?),",str(re.findall(r"rebate_ecoin(.+?)image_id",str(noble1))))
                print("retbate_coin:",retbate_coin)
                #开通贵族
                level=random.randint(0,len(noble_level)-1)
                buy_noble=requests.post(host +"/dev/appgw/buynoble?", data=common_function.buynoble(noble_level[level], noble_ecoin[level], retbate_coin[level], 0, vid, sessionid_watcher), verify=False)
                self.assertIn("ok",buy_noble.text)
                #贵族续费
                noble_continue=requests.post(host +"/dev/appgw/buynoble?", data=common_function.buynoble(noble_level[level], noble_ecoin[level], retbate_coin[level], 0, vid, sessionid_watcher), verify=False)
                self.assertIn("ok",noble_continue.text)
                #贵族自动续费
                noble_auto_continue=requests.post(host +"/dev/appgw/buynoble?", data=common_function.buynoble(noble_level[level], noble_ecoin[level], retbate_coin[level], 1, vid, sessionid_watcher), verify=False)
                self.assertIn("ok",noble_auto_continue.text)
                #获取专属礼物
                getparamnew=requests.get(host+"/dev/appgw/getparamnew?devtype=android&sessionid="+sessionid_watcher,verify=False)
                #获取第一个位置的专属礼物id和对应等级
                noblegift= common_function.get_noblegift_id(getparamnew)
                print("noblegift_id",noblegift,int(noblegift[1]))
                gift_position=int(noblegift[1])-1
                print("position",gift_position)
                #购买第一个贵族专属礼物对应的等级
                #开通贵族
                buy_noble=requests.post(host +"/dev/appgw/buynoble?", data=common_function.buynoble(noble_level[gift_position], noble_ecoin[gift_position], retbate_coin[gift_position], 0, vid, sessionid_watcher), verify=False)
                self.assertIn("ok",buy_noble.text)
                #赠送贵族专属礼物
                print(common_function.gift_data(1, perf_name, vid, noblegift[0], sessionid_watcher))
                noble_gift=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(1, perf_name, vid, noblegift[0], sessionid_watcher), verify=False)
                self.assertIn("ok",noble_gift.text)
                #获取饭团数
                get_riceroll8=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
                riceroll8=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll8.text))[4:-4])
                self.assertTrue(riceroll8>riceroll7)
                ###商城###
                #获取商城电子券列表
                get_e_coupon_list=requests.get(host+"/wgl/shop/goodslist?sessionid="+sessionid_watcher+"&type=2&number_type=1&goods_type=2,5&start=0&count=6",verify=False)
                self.assertIn("ok",get_e_coupon_list.text)
                #用正则筛选各类信息
                e_coupon_info= common_function.get_goodsinfo(get_e_coupon_list)
                #商品数量
                e_coupon__num=e_coupon_info[-1]
                #购买电子券商品,2代表电子券
                #获取商品数量最多的
                max_num=str(max(map(int,e_coupon__num)))
                if int(max_num)>0:
                    #判断数量最多的位置
                    e_coupon__position=e_coupon__num.index(max_num)
                    #购买电子券
                    e_shopping=requests.post(host +"/wgl/shop/goodsbuy", data=common_function.shopping(sessionid_watcher, 2, e_coupon_info[0][e_coupon__position], e_coupon_info[3][e_coupon__position], e_coupon_info[2][e_coupon__position], e_coupon_info[4][e_coupon__position], e_coupon_info[1][e_coupon__position], 1), verify=False)
                    #判断返回接口内容
                    self.assertIn("ok",e_shopping.text)
                    print(e_shopping.content.decode("unicode_escape"))
                else:
                    print(r"商城没有可购买的电子券")

            #购买认证
            #获取认证商品列表
            get_authen_list=requests.get(host+"/wgl/shop/goodslist?sessionid="+sessionid_watcher+"&type=2&number_type=1&goods_type=3&start=0&count=6",verify=False)
            print(get_authen_list.text)
            authen_info= common_function.get_goodsinfo(get_authen_list)
            authen_num=authen_info[-1]
            print(len(authen_info),authen_info)
            #获取商品数量最多的
            max_num1=str(max(map(int,authen_num)))
            print(max_num1)
            if int(max_num1)>0:
                #最大值的位置
                authen_position=authen_num.index(max_num1)
                #购买认证
                authen_shopping=requests.post(host +"/wgl/shop/goodsbuy", data=common_function.shopping(sessionid_watcher, 2, authen_info[0][authen_position], authen_info[3][authen_position], authen_info[2][authen_position], authen_info[4][authen_position], authen_info[1][authen_position], 1), verify=False)
                #判断返回内容
                self.assertIn("ok",authen_shopping.text)
                #打印返回后的内容
                print(authen_shopping.content.decode("unicode_escape"))
            else:
                print(r"商城没有可购买的认证")
            #购买座驾
            #获取座驾靓号商品列表
            seat_list=requests.get(host+"/wgl/shop/goodslist?sessionid="+sessionid_watcher+"&type=2&number_type=2&goods_type=4&start=0&count=6",verify=False)
            print(seat_list.text)
            seat_info= common_function.get_goodsinfo(seat_list)
            seat_num=seat_info[-1]
            print(len(seat_info),seat_num)
            #获取商品数量最多的
            max_num4=str(max(map(int,seat_num)))
            print(max_num4)
            if int(max_num4)>0:
                #最大值的位置
                seat_position=seat_num.index(max_num4)
                #购买生日靓号
                seat_shopping=requests.post(host +"/wgl/shop/goodsbuy", data=common_function.shopping(sessionid_watcher, 2, authen_info[0][seat_position], authen_info[3][seat_position], authen_info[2][seat_position], authen_info[4][seat_position], authen_info[1][seat_position], 1), verify=False)
                #判断返回内容
                self.assertIn("ok",seat_shopping.text)
                #打印返回后的内容
                print(r"座驾购买:",seat_shopping.content.decode("unicode_escape"))
            else:
                print(r"商城没有可购买的座驾")
            #购买8位靓号
            #获取8位靓号的礼物信息
            get_eightnumber_list=requests.get(host+"/wgl/shop/goodslist?sessionid="+sessionid_watcher+"&type=1&number_type=1&goods_type=0&start=0&count=6",verify=False)
            self.assertIn("ok",get_eightnumber_list.text)
            #提取id和type
            eightnumber_info= common_function.get_number(get_eightnumber_list)
            #购买8位靓号
            buy_eightnumber=requests.post(host +"/wgl/shop/goodsbuy", data=common_function.buy_number(sessionid_watcher, eightnumber_info[1][0][:-1], eightnumber_info[0][0]), verify=False)
            self.assertIn("ok",buy_eightnumber.text)
            #购买生日靓号
            #获取生日靓号信息
            get_birth_list=requests.get(host+"/wgl/shop/goodslist?sessionid="+sessionid_watcher+"&type=1&number_type=2&goods_type=0&start=0&count=6",verify=False)
            print(get_birth_list.text)
            #提取id和type
            birth_info= common_function.get_number(get_birth_list)
            #购买生日靓号
            buy_eightnumber=requests.post(host +"/wgl/shop/goodsbuy", data=common_function.buy_number(sessionid_watcher, birth_info[1][0][:-1], birth_info[0][0]), verify=False)
            self.assertIn("ok",buy_eightnumber.text)
        else:
            print(u"当前回放视频不存在付费视频")
Beispiel #7
0
    def test_watcher(self):
        #登录
        login_perf = requests.post(host + "/dev/appgw/userlogin?",
                                   data=common_function.login_data(
                                       "e10adc3949ba59abbe56e057f20f883e",
                                       13340962953),
                                   verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_perf.text)
        #提取主播的易播号name
        perf_name = str(re.findall(r"name(.+?)nickname",
                                   login_perf.text))[5:-5]
        print("perf_name:", perf_name)
        #获取sessionid
        sessionid_perf = str(re.findall(r"sessionid(.+?)auth",
                                        login_perf.text))[5:-5]
        print("performer sessionid:", sessionid_perf)
        #获取主播饭团数
        get_riceroll0 = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        self.assertIn("ok", get_riceroll0.text)
        riceroll0 = int(
            str(re.findall(r"riceroll(.+?)limitcash",
                           get_riceroll0.text))[4:-4])
        print("riceroll0", riceroll0)

        #观众登录
        login_watcher = requests.post(host + "/dev/appgw/userlogin?",
                                      data=common_function.login_data(
                                          "e10adc3949ba59abbe56e057f20f883e",
                                          18639658074),
                                      verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_watcher.text)
        #获取sessionid
        sessionid_watcher = str(
            re.findall(r"sessionid(.+?)auth", login_watcher.text))[5:-5]
        print("watcher sessionid:", sessionid_watcher)

        #获取直播名称
        topiclistnew = requests.get(
            host + "/dev/appgw/topiclistnew?count=10000&start=0&sessionid=" +
            sessionid_perf,
            verify=False)
        self.assertIn("ok", topiclistnew.text)
        #准备直播,获取vid
        prepare = requests.get(
            host + "/dev/appgw/liveprepare?switch=false&sessionid=" +
            sessionid_perf,
            verify=False)
        self.assertIn("ok", prepare.text)
        #提取返回内容中的vid
        vid = str(re.findall(r"vid(.+?)live_url", prepare.text))[5:-5]
        print("vid:", vid)

        #准备直播
        liveprepare = requests.get(
            host + "/dev/appgw/liveprepare?switch=false&sessionid=" +
            sessionid_perf,
            verify=False)
        self.assertIn("ok", liveprepare.text)
        #
        monitor1_data = {
            "header": {
                "sdk_type": "streamer",
                "sdk_ver": "5.0.1.3",
                "platform": "android",
                "os_ver": "6.0",
                "pkg": "com.ccvideo",
                "dev_model": "HUAWEI VNS-AL00",
                "dev_id": "863293039381774",
                "log_ver": "2.0.1",
                "log_vn": 102
            },
            "body": [{
                "_id": "2b89eda9-4fa4-4b64-8772-9060c40a9143",
                "type": 100,
                "body_type": "endStreaming",
                "action_id": "AAC54B080AEAE89EDCBABBF9CA011A57",
                "streamId": "AAC54B080AEAE89EDCBABBF9CA011A57",
                "streaming_len": 0,
                "send_slow_cnt": 0,
                "drop_frame_cnt": 0,
                "drop_frame_cnt_am": 0,
                "drop_frame_cnt_bm": 0,
                "net_type": "WIFI",
                "net_des": "N\/A",
                "upload_size": 0,
                "encode_frame_cnt": 0,
                "end_type": 0,
                "end_role": "PUB",
                "date": 0,
                "audio_channels": 1,
                "auto_adjust_bitrate": "true",
                "is_landspace": "false",
                "is_front_mirror": "true",
                "iframe_interval": 3,
                "max_video_bitrate": 1200,
                "min_video_bitrate": 500,
                "video_bitrate": 800,
                "sample_audio_rate": 44100,
                "audio_bitrate": 48,
                "resolution": "544x864",
                "framerate": 15,
                "video_encode_type": "soft264",
                "audio_encode_type": "soft_aac_he",
                "video_encode_perf": "LowPower",
                "live_scence": "Showself"
            }, {
                "type": 100,
                "body_type": "function_point",
                "function_type": "display_glsurface",
                "net_type": "WIFI",
                "date": int(float(time.time()) * 1000)
            }, {
                "type": 100,
                "body_type": "beautify",
                "beautify_type": "ImgBeautyProFilter",
                "net_type": "WIFI",
                "date": int(float(time.time()) * 1000)
            }, {
                "type": 100,
                "body_type": "beautify",
                "beautify_type": "ImgBeautyProFilter",
                "net_type": "WIFI",
                "date": int(float(time.time()) * 1000)
            }, {
                "type": 100,
                "body_type": "beautify",
                "beautify_type": "ImgSTFilter",
                "net_type": "WIFI",
                "date": int(float(time.time()) * 1000)
            }]
        }
        monitor1data = json.dumps(monitor1_data)
        monitor1 = requests.post(
            "http://videodev.ksyun.com:8980/univ/monitorclient?accesskey=D8uDWZ88ZKUCPu0KRJkR&expire=1562896222&uniqname=ksystreamer_android&contmd5=482ABC428C6F01E507F8F9BD501167BE&signature=35K5TgmBDGCxw5lweEYLiYI7cGU%3D",
            data=monitor1data,
            verify=False)
        print("monitor1:", monitor1.text)
        #开启付费直播
        livestart = requests.get(
            host + "/dev/appgw/livestart?vid=" + vid +
            "&quality=normal&permission=7&thumb=0&price=20&sessionid=" +
            sessionid_perf +
            "&title=%E9%A1%BE%E5%AE%A2%E4%BB%AC%E5%B8%A6%E4%BD%A0%E8%BA%AB%E4%B8%B4%E5%85%B6%E5%A2%83%EF%BC%8C%E4%B8%8D%E5%AE%B9%E9%94%99%E8%BF%87&gps_latitude=30.542021&mode=0&gps=1&accompany=0&nettype=wifi&gps_longitude=104.060578&cp=V0_P1_S0_E1_R1_B0_A0_CN_M0",
            verify=False)
        print("livestart:", livestart.text)
        self.assertIn("ok", livestart.text)
        #
        permission = requests.get(
            "http://dev.yizhibo.tv:8095/ieasy/pk/permission?&vid=" + vid +
            "&sessionid=" + sessionid_perf,
            verify=False)
        print("permission:", permission.text)
        #付费直播ing
        #设置视频分类

        videosettopic = requests.get(
            host + "/dev/appgw/videosettopic?topic_id=220&vid=" + vid +
            "&sessionid=" + sessionid_perf,
            verify=False)
        self.assertIn("ok", videosettopic.text)
        #获取房间设置信息
        getroominfo = requests.get(host + "/dev/appgw/getroominfo?vid=" + vid +
                                   "&roomid=" + perf_name + "&sessionid=" +
                                   sessionid_perf,
                                   verify=False)
        self.assertIn("ok", getroominfo.text)
        #推流?
        permission = requests.get(
            "http://dev.yizhibo.tv:8095/ieasy/pk/permission?&vid=" + vid +
            "&sessionid=" + sessionid_perf,
            verify=False)
        self.assertIn("ok", permission.text)
        #更新直播状态
        liveupdatestatus = requests.get(
            host + "/dev/appgw/liveupdatestatus?status=0&vid=" + vid +
            "&sessionid=" + sessionid_perf,
            verify=False)
        self.assertIn("ok", liveupdatestatus.text)
        #获取用户财产信息
        getusermoney = requests.get(host + "/dev/appgw/pay/asset?sessionid=" +
                                    sessionid_watcher,
                                    verify=False)
        self.assertIn("ok", getusermoney.text)
        #观众观看直播返回E_PAYMENT
        watchstart = requests.get(
            host +
            "/dev/appgw/watchstart?gps_longitude=104.060626&vid=vOxMhVkMrdFdAd&sessionid="
            + sessionid_watcher + "&gps_latitude=30.542037",
            verify=False)
        #self.assertIn("E_PAYMENT",watchstart.text)
        #观众需要付费才能观看
        watchprepare = requests.get(
            host +
            "/dev/appgw/watchprepare?gps_longitude=104.060626&gps_latitude=30.542037&vid="
            + vid + "&sessionid=" + sessionid_watcher,
            verify=False)
        #self.assertIn("ok",watchprepare.text)
        #观众支付易币进入直播间
        livepay = requests.get(
            host +
            "/dev/appgw/livepay?gps_longitude=104.060626&gps_latitude=30.542037&vid="
            + vid + "&sessionid=" + sessionid_watcher,
            verify=False)
        print(
            host +
            "/dev/appgw/livepay?gps_longitude=104.060626&gps_latitude=30.542037&vid="
            + vid + "&sessionid=" + sessionid_watcher)
        print(livepay.text)
Beispiel #8
0
    def test_freeliv_pk(self):

        #登录PK所需账号主播1、主播2、观众
        #登录主播1
        login_perf1 = requests.post(host + "/dev/appgw/userlogin?",
                                    data=common_function.login_data(
                                        "e10adc3949ba59abbe56e057f20f883e",
                                        13340962953),
                                    verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_perf1.text)
        #提取主播的易播号name
        perf_name1 = str(re.findall(r"name(.+?)nickname",
                                    login_perf1.text))[5:-5]
        print("perf_name1:", perf_name1)
        #获取sessionid1
        sessionid_perf1 = str(
            re.findall(r"sessionid(.+?)auth", login_perf1.text))[5:-5]
        print("performer sessionid1:", sessionid_perf1)
        #登录主播2
        login_perf2 = requests.post(host + "/dev/appgw/userlogin?",
                                    data=common_function.login_data(
                                        "e10adc3949ba59abbe56e057f20f883e",
                                        13340962953),
                                    verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_perf2.text)
        #提取主播的易播号name
        perf_name2 = str(re.findall(r"name(.+?)nickname",
                                    login_perf2.text))[5:-5]
        print("perf_name2:", perf_name2)
        #获取sessionid2
        sessionid_perf2 = str(
            re.findall(r"sessionid(.+?)auth", login_perf2.text))[5:-5]
        print("performer sessionid2:", sessionid_perf2)

        #观众登录
        login_watcher = requests.post(host + "/dev/appgw/userlogin?",
                                      data=common_function.login_data(
                                          "e10adc3949ba59abbe56e057f20f883e",
                                          18639658074),
                                      verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_watcher.text)
        #提取观看端的易播号name
        watcher_name = str(re.findall(r"name(.+?)nickname",
                                      login_watcher.text))[5:-5]
        print("watcher_name:", watcher_name)
        #获取sessionid
        sessionid_watcher = str(
            re.findall(r"sessionid(.+?)auth", login_watcher.text))[5:-5]
        print("watcher sessionid:", sessionid_watcher)

        #主播1准备直播,获取vid
        preparelive1 = requests.get(
            host + "/dev/appgw/liveprepare?switch=false&sessionid=" +
            sessionid_perf1,
            verify=False)
        self.assertIn("ok", preparelive1.text)
        #提取返回内容中的vid
        vid1 = str(re.findall(r"vid(.+?)live_url", preparelive1.text))[5:-5]
        print("vid1:", vid1)
        #开启直播
        livestart1 = requests.get(
            host + "/dev/appgw/livestart?vid=" + vid1 +
            "&quality=normal&permission=0&thumb=0&sessionid=" +
            sessionid_perf1 +
            "&title=performer%E5%B8%A6%E4%BD%A0%E8%BA%AB%E4%B8%B4%E5%85%B6%E5%A2%83%EF%BC%8C%E4%B8%8D%E5%AE%B9%E9%94%99%E8%BF%87&gps_latitude=30.542094&mode=0&gps=1&accompany=0&nettype=wifi&gps_longitude=104.061429&cp=V0_P1_S0_E1_R1_B0_A0_CN_M0",
            verify=False)
        self.assertIn("ok", livestart1.text)
        #主播2准备直播,获取vid
        preparelive2 = requests.get(
            host + "/dev/appgw/liveprepare?switch=false&sessionid=" +
            sessionid_perf2,
            verify=False)
        self.assertIn("ok", preparelive2.text)
        #提取返回内容中的vid
        vid2 = str(re.findall(r"vid(.+?)live_url", preparelive2.text))[5:-5]
        print("vid2:", vid2)
        #开启直播
        livestart2 = requests.get(
            host + "/dev/appgw/livestart?vid=" + vid2 +
            "&quality=normal&permission=0&thumb=0&sessionid=" +
            sessionid_perf1 +
            "&title=performer%E5%B8%A6%E4%BD%A0%E8%BA%AB%E4%B8%B4%E5%85%B6%E5%A2%83%EF%BC%8C%E4%B8%8D%E5%AE%B9%E9%94%99%E8%BF%87&gps_latitude=30.542094&mode=0&gps=1&accompany=0&nettype=wifi&gps_longitude=104.061429&cp=V0_P1_S0_E1_R1_B0_A0_CN_M0",
            verify=False)
        self.assertIn("ok", livestart2.text)

        #主播1开启PK
        preparepk1 = requests.get(
            "http://dev.yizhibo.tv:8095/ieasy/pk/apply?&vid=" + vid1 +
            "&sessionid=" + sessionid_perf1,
            verify=False)
        self.assertIn("ok", preparepk1.text)
        #主播2开启PK
        preparepk2 = requests.get(
            "http://dev.yizhibo.tv:8095/ieasy/pk/apply?&vid=" + vid2 +
            "&sessionid=" + sessionid_perf2,
            verify=False)
        self.assertIn("ok", preparepk2.text)

        #准备接受PK邀请
        acceptpk = requests.get(
            host + "http://dev.yizhibo.tv:8095/ieasy/pk/accept?&sessionid=" +
            sessionid_perf1,
            verify=False)
        self.assertIn("ok", acceptpk.text)

        usersimpleinfo = requests.get(
            host + "/dev/appgw/usersimpleinfo?&name=" + perf_name2 +
            "&sessionid=" + sessionid_perf1,
            verify=False)
        self.assertIn("ok", usersimpleinfo.text)
        enterPkSuccess = requests.get(
            "http://dev.yizhibo.tv:8095/ieasy/pk/enterPkSuccess?&pkId=1180&sessionid=OecA3t97EMALhzyBLVMMCLL78pQj40ZS"
        )
Beispiel #9
0
    def test_privateletter(self):
        #登录
        login_perf = requests.post(host + "/dev/appgw/userlogin?",
                                   data=common_function.login_data(
                                       "e10adc3949ba59abbe56e057f20f883e",
                                       13399887766),
                                   verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_perf.text)
        #提取主播的易播号name
        perf_name = str(re.findall(r"name(.+?)nickname",
                                   login_perf.text))[5:-5]
        print("perf_name:", perf_name)
        #获取sessionid
        sessionid_perf = str(re.findall(r"sessionid(.+?)auth",
                                        login_perf.text))[5:-5]
        print("performer sessionid:", sessionid_perf)
        #获取用户信息
        perf_userinfo = requests.get(host + "/dev/appgw/userinfo?name=" +
                                     perf_name + "&sessionid=" +
                                     sessionid_perf,
                                     verify=False)
        print("perf_userinfo:", perf_userinfo.text)
        #提取主播私信im账号
        perf_im = str(
            re.findall(r'"new_imuser":(.+?),"usercenterbg"',
                       perf_userinfo.text))[3:-3]
        print("perf_im:", perf_im)

        #观众登录
        login_watcher = requests.post(host + "/dev/appgw/userlogin?",
                                      data=common_function.login_data(
                                          "e10adc3949ba59abbe56e057f20f883e",
                                          13399778866),
                                      verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok", login_watcher.text)
        #获取sessionid
        sessionid_watcher = str(
            re.findall(r"sessionid(.+?)auth", login_watcher.text))[5:-5]
        print("watcher sessionid:", sessionid_watcher)
        #提取主播的易播号name
        watcher_name = str(re.findall(r"name(.+?)nickname",
                                      login_watcher.text))[5:-5]
        print("watcher_name:", watcher_name)
        #获取用户信息
        watcher_userinfo = requests.get(host + "/dev/appgw/userinfo?name=" +
                                        perf_name + "&sessionid=" +
                                        sessionid_perf,
                                        verify=False)
        print("watcher_userinfo:", watcher_userinfo.text)
        #提取观众私信im账号
        watcher_im = str(
            re.findall(r'"new_imuser":(.+?),"usercenterbg"',
                       watcher_userinfo.text))[3:-3]
        print("watcher_im:", watcher_im)

        #私信红包
        redpack_data = {
            "messageContent": [{
                "content": "czfeyevz1563184982pdwu0040famw10",
                "hasTake": 0,
                "price": 20,
                "title": "恭喜发财,大吉大利!",
                "type": 1
            }],
            "messageContentType":
            2,
            "messageType":
            2,
            "receiver":
            perf_im,
            "sender":
            watcher_im,
            "sessionid":
            sessionid_watcher,
            "signature":
            "dc604b75cd80a8da3df776a51769846983092fcd"
        }
        privateredpack = requests.post(host +
                                       "/imserver/v1/message/sendmessage?",
                                       data=redpack_data,
                                       verify=False)
        print(privateredpack.text)
        creatredpack = requests.get(
            host + "/dev/appgw//pay/redpack/group/create?count=1&sessionid=" +
            sessionid_watcher +
            "&title=%E6%81%AD%E5%96%9C%E5%8F%91%E8%B4%A2%EF%BC%8C%E5%A4%A7%E5%90%89%E5%A4%A7%E5%88%A9%EF%BC%81&ecoin=20",
            verify=False)
        self.assertIn("ok", creatredpack.text)

        #私信转账
        imservertransferaccounts = requests.get(
            host + "/dev/appgw/imservertransferaccounts?&to_name=" +
            perf_name + "&to_imuser="******"&ecoin=2&sessionid=" +
            sessionid_watcher,
            verify=False)
        self.assertIn("ok", imservertransferaccounts.text)
Beispiel #10
0
    def test_solotalk(self):
        #登录
        login_perf=requests.post(host +"/dev/appgw/userlogin?", data=common_function.login_data("e10adc3949ba59abbe56e057f20f883e", 13399887766), verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok",login_perf.text)
        #提取主播的易播号name
        perf_name=str(re.findall(r"name(.+?)nickname",login_perf.text))[5:-5]
        print("perf_name:",perf_name)
        #获取sessionid
        sessionid_perf=str(re.findall(r"sessionid(.+?)auth",login_perf.text))[5:-5]
        print("performer sessionid:",sessionid_perf)
        #获取主播饭团数
        get_riceroll0=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",get_riceroll0.text)
        riceroll0=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll0.text))[4:-4])
        print("riceroll0",riceroll0)

        #观众登录
        login_watcher=requests.post(host +"/dev/appgw/userlogin?", data=common_function.login_data("e10adc3949ba59abbe56e057f20f883e", 13399778866), verify=False)
        #验证返回内容中是否有“ok”字样
        self.assertIn("ok",login_watcher.text)
        #获取sessionid
        sessionid_watcher=str(re.findall(r"sessionid(.+?)auth",login_watcher.text))[5:-5]
        print("watcher sessionid:",sessionid_watcher)
        #提取主播的易播号name
        watcher_name=str(re.findall(r"name(.+?)nickname",login_watcher.text))[5:-5]
        print("watcher_name:",watcher_name)

        ###开启公开直播,购买贵族###
         #准备直播,获取vid
        prepare=requests.get(host+"/dev/appgw/liveprepare?switch=false&sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",prepare.text)
        #提取返回内容中的vid
        vid=str(re.findall(r"vid(.+?)live_url",prepare.text))[5:-5]
        print("vid:",vid)
        #开启直播
        livestart=requests.get(host+"/dev/appgw/livestart?vid="+vid+"&quality=normal&permission=0&thumb=0&sessionid="+sessionid_perf+"&title=performer%E5%B8%A6%E4%BD%A0%E8%BA%AB%E4%B8%B4%E5%85%B6%E5%A2%83%EF%BC%8C%E4%B8%8D%E5%AE%B9%E9%94%99%E8%BF%87&gps_latitude=30.542094&mode=0&gps=1&accompany=0&nettype=wifi&gps_longitude=104.061429&cp=V0_P1_S0_E1_R1_B0_A0_CN_M0",verify=False)
        self.assertIn("ok",livestart.text)
        #获取贵族信息
        get_noble=requests.post(host +"/dev/appgw/getnobleinfo?", data=common_function.headers(sessionid_watcher), verify=False)
        noble1=re.findall(r'"noble_list":(.+?)}}',get_noble.text)
        print("get_nolble:",noble1)
        #截取noble_level
        noble_level=re.findall(r":(.+?),",str(re.findall(r"noble_level(.+?)name",str(noble1))))
        print("noble_level:",noble_level)
        #截取开通贵族价值易币
        noble_ecoin=re.findall(r":(.+?),",str(re.findall(r"ecoin(.+?)rebate_ecoin",str(noble1))))
        print("noble_ecoin: ",noble_ecoin)
        #截取返回易币
        retbate_coin=re.findall(r":(.+?),",str(re.findall(r"rebate_ecoin(.+?)image_id",str(noble1))))
        print("retbate_coin:",retbate_coin)
        #开通贵族公爵或者亲王
        level=random.randint(len(noble_level)-3,len(noble_level)-2)
        buy_noble=requests.post(host +"/dev/appgw/buynoble?", data=common_function.buynoble(noble_level[level], noble_ecoin[level], retbate_coin[level], 0, vid, sessionid_watcher), verify=False)
        self.assertIn("ok",buy_noble.text)
        #获取专属礼物
        getparamnew=requests.get(host+"/dev/appgw/getparamnew?devtype=android&sessionid="+sessionid_watcher,verify=False)
        #获取第一个位置的专属礼物id和对应等级
        noblegift= common_function.get_noblegift_id(getparamnew)
        print("noblegift_id&level",noblegift[0],int(str(noblegift[1])[:-10]))
        gift_position=noble_level.index(str(noblegift[1])[:-10])
        print("position",gift_position)
        #购买珍爱守护
        buy_love=requests.get(host+"/dev/appgw/pay/buyguardian?vid="+vid+"&guardianid=3&to_user="******"&sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",buy_love.text)



        #主播端准备秘聊
        anchorstartsolo=requests.get(host+"/dev/appgw/anchorstartsolo?price=10&sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorstartsolo.text)
        print("anchorstartsolo: ",anchorstartsolo.text)
        solo_id=re.findall(r'"solo_id":(.+?),"channel_id"',anchorstartsolo.text)
        print("solo_id: ",solo_id)
        #更新秘聊心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #观众端更新/监听秘聊请求并判断目标主播发起的秘聊是否存在
        while True:
            anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
            self.assertIn("ok",anchorsoloheartbt.text)
            sololist=requests.get(host+"/dev/appgw/sololist?&type=1&start=0&count=20&sessionid="+sessionid_watcher,verify=False)
            solonames=re.findall(r'"name":"(.+?)","location"',sololist.text)
            print(solonames)
            self.assertIn("ok",sololist.text)
            anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
            self.assertIn("ok",anchorsoloheartbt.text)
            if perf_name in solonames:
                break
        #用户向主播发起秘聊申请
        usercallsolo=requests.get(host+"/dev/appgw/usercallsolo?solo_id="+str(solo_id)[2:-2]+"&sessionid="+sessionid_watcher,verify=False)
        print("usercallsolo:",host+"/dev/appgw/usercallsolo?solo_id="+str(solo_id)[2:-2]+"&sessionid="+sessionid_watcher)
        self.assertIn("ok",usercallsolo.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)
        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #主播接受秘聊申请
        anchoracceptsolo=requests.get(host+"/dev/appgw/anchoracceptsolo?accept=1&username="******"&sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchoracceptsolo.text)
        print("anchoracceptsolo:",anchoracceptsolo.text)
        #获取秘聊视频的VID
        vid=str(re.findall(r'"vid":(.+?),"permission"',anchoracceptsolo.text))[3:-3]
        print("vid:",vid)
        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)
        #获取接受秘聊后饭团是否增加
        get_riceroll01=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        riceroll01=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll01.text))[4:-4])
        #self.assertTrue(riceroll01>riceroll0)

        #获取主播信息
        userbaseinfo=requests.get(host+"/dev/appgw/userbaseinfo?name="+perf_name+"&sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",userbaseinfo.text)
        #获取主播饭团数
        asset=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        print("asset:",asset.text)
        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)
        #真心话
        soloquestion1=requests.get(host+"/dev/appgw/soloquestionbuy?&questionid=1&anchorname="+perf_name+"&vid="+vid+"&sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",soloquestion1.text)
        #判断真心话是否增加饭团
        get_riceroll02=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        riceroll02=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll02.text))[4:-4])
        self.assertTrue(riceroll02>riceroll01)
        #大冒险
        soloquestion2=requests.get(host+"/dev/appgw/soloquestionbuy?&questionid=3&anchorname="+perf_name+"&vid="+vid+"&sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",soloquestion1.text)
        #判断大冒险是否增加饭团
        get_riceroll03=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        riceroll03=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll03.text))[4:-4])
        self.assertTrue(riceroll03>riceroll02)
        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)
        #赠送礼物:么么哒*1
        send_Agift01=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(1, perf_name, vid, 332, sessionid_watcher), verify=False)
        self.assertIn("ok",send_Agift01.text)
        #获取饭团数
        get_riceroll1=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        riceroll1=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll1.text))[4:-4])
        self.assertTrue(riceroll1>riceroll03)

        #赠送幸运礼物:幸运1黑丝*1
        send_Bgift01=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(1, perf_name, vid, 309, sessionid_watcher), verify=False)
        self.assertIn("ok",send_Bgift01.text)
        #获取饭团数
        get_riceroll2=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        riceroll2=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll2.text))[4:-4])
        self.assertTrue(riceroll2>riceroll1)

        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)

        #赠送钻石礼物:10钻石礼物*1
        send_Cgift01=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(1, perf_name, vid, 308, sessionid_watcher), verify=False)
        self.assertIn("ok",send_Cgift01.text)
        #获取饭团数
        get_riceroll3=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        riceroll3=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll3.text))[4:-4])
        self.assertTrue(riceroll3>riceroll2)

        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)

        #赠送普通礼物*2
        send_Agift02=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(2, perf_name, vid, 332, sessionid_watcher), verify=False)
        self.assertIn("ok",send_Agift02.text)
        #获取饭团数
        get_riceroll4=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        riceroll4=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll4.text))[4:-4])
        self.assertTrue(riceroll4>riceroll3)

        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)

        #赠送幸运礼物:幸运1黑丝*520
        send_Bgift02=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(520, perf_name, vid, 309, sessionid_watcher), verify=False)
        self.assertIn("ok",send_Bgift02.text)
        #获取饭团数
        get_riceroll5=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        riceroll5=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll5.text))[4:-4])
        self.assertTrue(riceroll5>riceroll4)

        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)

        #赠送钻石礼物:10钻石礼物*9
        send_Cgift02=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(9, perf_name, vid, 308, sessionid_watcher), verify=False)
        self.assertIn("ok",send_Cgift02.text)
        #获取饭团数
        get_riceroll6=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
        riceroll6=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll6.text))[4:-4])
        self.assertTrue(riceroll6>riceroll5)
        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)

        #随机赠送任意数量、任一礼物*3次
        for i in range(0,2):
            gifts=["308","309","332","307","311","334"]
            gift_data={
                "number":random.randint(1,20),
                "name":perf_name,
                "vid":vid,
                "goodsid":int(random.choice(gifts)),
                "sessionid":sessionid_watcher
            }
            send_gift=requests.post(host+"/dev/appgw/pay/buy?",data=gift_data,verify=False)
            self.assertIn("ok",send_gift.text)
            #维持主播心跳
            anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
            self.assertIn("ok",anchorsoloheartbt.text)
            #用户心跳
            usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
            self.assertIn("ok",usersoloheartbt.text)
            #获取饭团数
            get_riceroll7=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
            riceroll7=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll7.text))[4:-4])
            self.assertTrue(riceroll7>riceroll6)
            print("这是第",i+1,"次")
        #普通单抽
        #普通十连抽


        #高级单抽
        get_high_one=requests.get(host+"/dev/agservice/admin/superlottery?vid="+vid+"&sessionid="+sessionid_watcher+"&number=1",verify=False)
        self.assertIn("ok",get_high_one.text)
        #高级十连抽
        get_high_ten=requests.get(host+"/dev/agservice/admin/superlottery?vid="+vid+"&sessionid="+sessionid_watcher+"&number=10",verify=False)
        self.assertIn("ok",get_high_ten.text)
        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)
        #高级百连抽
        get_high_ten=requests.get(host+"/dev/agservice/admin/superlottery?vid="+vid+"&sessionid="+sessionid_watcher+"&number=100",verify=False)
        self.assertIn("ok",get_high_ten.text)
        #送背包礼物(考虑观影券问题)
        #获取背包礼物信息
        get_package_info=requests.get(host+"/dev/appgw/userpackagetools?&start=0&count=100000&sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",get_package_info.text)
        #获取礼物名称
        package_list=get_package_info.content.decode("unicode_escape")
        print(package_list)
        #获取背包道具的type和tool_id
        packagegoods_info= common_function.get_packagegoods_info(get_package_info)

        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)
        #判断是否存在可赠送礼物type为1
        if '1' in packagegoods_info[0]:
            print("背包存在可赠送礼物")
            bag_position=packagegoods_info[0].index('1')
            print("bag_position",bag_position)
            tool_id=packagegoods_info[1][bag_position]
            #赠送背包道具
            send_pag_gift=requests.get(host+"/dev/appgw/usepackagetool?&number=1&touser="******"&vid="+vid+"&usetype=1&toolid="+tool_id+"&sessionid="+sessionid_watcher,verify=False)
            print(send_pag_gift.content.decode("unicode_escape"))
            self.assertIn("ok",send_pag_gift.text)
            #获取饭团数
            get_riceroll1=requests.get(host+"/dev/appgw/pay/asset?sessionid="+sessionid_perf,verify=False)
            riceroll1=int(str(re.findall(r"riceroll(.+?)limitcash",get_riceroll1.text))[4:-4])
            self.assertTrue(riceroll1>riceroll0)
        else:
            print("背包没有可赠送礼物")

        #转赠礼物
        gift_giving=requests.get(host+"/dev/appgw/usepackagetool?&toolid="+packagegoods_info[1][0]+"&usetype=2&vid="+vid+"&number=1&touser="******"&sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",gift_giving.text)

        #维持主播心跳
        anchorsoloheartbt=requests.get(host+"/dev/appgw/anchorsoloheartbt?sessionid="+sessionid_perf,verify=False)
        self.assertIn("ok",anchorsoloheartbt.text)
        #用户心跳
        usersoloheartbt=requests.get(host+"/dev/appgw/usersoloheartbt?sessionid="+sessionid_watcher,verify=False)
        self.assertIn("ok",usersoloheartbt.text)

        #赠送低等级贵族专属礼物(伯爵 342)
        noble_gift0=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(1, perf_name, vid, 342, sessionid_watcher), verify=False)
        self.assertIn("ok",noble_gift0.text)
        #赠送高等级贵族专属礼物(皇帝 341)
        noble_gift1=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(1, perf_name, vid, 341, sessionid_watcher), verify=False)
        self.assertIn("E_USER_NOBLE_LEVEL_LIMIT",noble_gift1.text)
        #赠送珍爱守护礼物(珍爱1 360)
        noble_gift2=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(1, perf_name, vid, 360, sessionid_watcher), verify=False)
        self.assertIn("ok",noble_gift2.text)
        #赠送珍爱守护礼物(一生20 359)
        noble_gift3=requests.post(host +"/dev/appgw/pay/buy?", data=common_function.gift_data(1, perf_name, vid, 359, sessionid_watcher), verify=False)
        self.assertIn("E_USER_GUARDIAN_LEVEL_LIMIT",noble_gift3.text)