Ejemplo n.º 1
0
    def test_c_getUserInf_success(self, value):
        """获取用户信息 正常 接口/controller/app/netease/getUserInfo"""
        json_re = json.loads(value["_response"])
        apiToken = json_re["return_context"]["apiToken"]
        userId = json_re["return_context"]["results"][0]["userid"]
        channelId = json_re["return_context"]["channelId"]

        configHttp.set_url("/controller/app/netease/getUserInfo")
        params = {
            "apiToken": apiToken,
            "channelId": channelId,
            "uid": userId,
            "imgUid": "15269803060001",
            "client": "iOS",
            "clientVersion": "1.2",
            "d_model": "iPhone",
            "osVersion": "11.0.3",
            "networkType": "wifi"
        }
        configHttp.set_data(params)
        response = configHttp.post()
        result = response.content.decode("utf-8")
        log.info("getUserInfo 接口返回数据:" + result)
        ExcelUtils.api_write_data("test", 2, 4, json.dumps({"_params":
                                                            params}))
        ExcelUtils.api_write_data("test", 2, 5,
                                  json.dumps({"_response": result}))
        re_json = json.loads(result)
        self.assertEqual(re_json["code"], 200)
Ejemplo n.º 2
0
 def test_f_getClassitfyProductlist_success(self, value):
     """获取首页商品  成功 接口/controller/app/goods/v41/getClassitfyProductlist"""
     json_re = json.loads(value["_response"])
     apiToken = json_re["return_context"]["apiToken"]
     userId = json_re["return_context"]["results"][0]["userid"]
     channelId = json_re["return_context"]["channelId"]
     configHttp.set_url("/controller/app/goods/v41/getClassitfyProductlist")
     params = {
         "apiToken": apiToken,
         "channelId": channelId,
         "uid": userId,
         "imgUid": "15269803060001",
         "client": "iOS",
         "clientVersion": "1.2",
         "d_model": "iPhone",
         "osVersion": "11.0.3",
         "networkType": "wifi",
         "pageCount": 1,
         "sortType": 1,
         "ifRecommend": 2
     }
     configHttp.set_data(params)
     response = configHttp.post()
     result = response.content.decode("utf-8")
     log.info("getClassitfyProductlist 接口返回数据:" + result)
     ExcelUtils.api_write_data("test", 5, 4, json.dumps({"_params":
                                                         params}))
     ExcelUtils.api_write_data("test", 5, 5,
                               json.dumps({"_response": result}))
     re_json = json.loads(result)
     self.assertEqual(re_json["return_code"], "SUCCESS", msg="失败")
     self.assertIsNotNone(re_json["return_context"],
                          msg="return_context数据为空")
Ejemplo n.º 3
0
 def test_a_loginMD5_success(self, value):
     """正常账号登录  成功 接口/controller/app/login/loginMD5"""
     url = value["_api"]
     params = value["_params"][0]
     # log.info("url: "+url+"  params: "+ str(params))
     configHttp.set_url(url)
     configHttp.set_data(params)
     response = configHttp.post()
     result = response.content.decode("utf-8")
     re_json = json.loads(result)
     log.info("loginMD5 接口返回数据:" + result)
     ExcelUtils.api_write_data("test", 1, 5,
                               json.dumps({"_response": result}))
     self.assertEqual(int(response.status_code), 200, "不一致")
     self.assertEqual(re_json["return_context"]["status"], 0, "不一致")
Ejemplo n.º 4
0
    def test_d_gethomepageCatagory_success(self, value):
        """获取首页信息  成功 接口/controller/app/goods/gethomepageCatagory"""
        json_re = json.loads(value["_response"])
        apiToken = json_re["return_context"]["apiToken"]
        userId = json_re["return_context"]["results"][0]["userid"]
        channelId = json_re["return_context"]["channelId"]

        configHttp.set_url("/controller/app/goods/gethomepageCatagory")
        params = "apiToken=" + apiToken + "&channelId=" + channelId + "&client=iOS&clientVersion=1.2&d_model=iPhone&networkType=WiFi&osVersion=11.0.3&uid=" + userId
        configHttp.set_params(params)
        response = configHttp.get()
        result = response.content.decode("utf-8")
        log.info("gethomepageCatagory 接口返回数据:" + result)
        ExcelUtils.api_write_data("test", 3, 4, json.dumps({"_params":
                                                            params}))
        ExcelUtils.api_write_data("test", 3, 5,
                                  json.dumps({"_response": result}))
        re_json = json.loads(result)
        self.assertEqual(re_json["error"], 0, "error返回值不一致")
        self.assertEqual(re_json["status"], 0, "status返回值不一致")
        self.assertIsNotNone(re_json["results"], "results内容为空")