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

优化

parent 6d88e59b
......@@ -36,6 +36,7 @@ result = json.loads(result.content)
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_id = result["data"]["list"][random_demand]["demandId"]
demand_code = result["data"]["list"][random_demand]["demandCode"]
# print(demand_id)
# 第三步获取原订单信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url18")
......@@ -52,18 +53,26 @@ result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
result = json.loads(result.content)
# 将接口影响时间添加至结果中
result["api_time"] = api_time
if result["success"]:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict18")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
elif result["code"] == "ERROR":
# 获取预期结果/原需求单中商品无效获取被删除
check_dict = commonFuc().get_business_data(module, "checkDictInvalid")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
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