Commit 8d6dd75a authored by liguangyu06's avatar liguangyu06
Browse files

优化

parent 6d88e59b
...@@ -36,6 +36,7 @@ result = json.loads(result.content) ...@@ -36,6 +36,7 @@ result = json.loads(result.content)
random_demand = random.randint(0, len(result["data"]["list"]) - 1) random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息 # 获取需求单信息
demand_id = result["data"]["list"][random_demand]["demandId"] demand_id = result["data"]["list"][random_demand]["demandId"]
demand_code = result["data"]["list"][random_demand]["demandCode"]
# print(demand_id) # print(demand_id)
# 第三步获取原订单信息 # 第三步获取原订单信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url18") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url18")
...@@ -52,18 +53,26 @@ result = requests.get(url, params=request_body, headers=headers) ...@@ -52,18 +53,26 @@ result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间 # 获取接口响应时间
api_time = float(result.elapsed.total_seconds()) api_time = float(result.elapsed.total_seconds())
result = json.loads(result.content) result = json.loads(result.content)
# 将接口影响时间添加至结果中
result["api_time"] = api_time result["api_time"] = api_time
if result["success"]: if result["success"]:
# 获取预期结果 # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict18") check_dict = commonFuc().get_business_data(module, "checkDict18")
# print(check_dict) # print(check_dict)
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) commonFuc().check_result(check_dict, result)
else: elif result["code"] == "ERROR":
# 获取预期结果 # 获取预期结果/原需求单中商品无效获取被删除
check_dict = commonFuc().get_business_data(module, "checkDictInvalid") check_dict = commonFuc().get_business_data(module, "checkDictInvalid")
# print(check_dict) # print(check_dict)
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) commonFuc().check_result(check_dict, result)
else:
# 获取预期结果/原需求单为历史脏数据导致接口异常
check_dict = commonFuc().get_business_data(module, "checkDict_code", demand_code)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment