Commit 6e2fe119 authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

parent 5019fc31
...@@ -37,7 +37,17 @@ rebate_id = result["data"]["list"][rebate_random]["rebateid"] ...@@ -37,7 +37,17 @@ rebate_id = result["data"]["list"][rebate_random]["rebateid"]
# 第三步获取返利规则详情信息 # 第三步获取返利规则详情信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url23") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url23")
request_body = commonFuc().get_business_data(module, "payload23", rebate_id) request_body = commonFuc().get_business_data(module, "payload23", rebate_id)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取规则对应的客户信息
customer_code = result["data"]["customerDataList"][random.randint(0, len(result["data"]["customerDataList"]) - 1)][
"customercode"]
# 第四步获取客户对应的返利规则
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url28")
request_body = commonFuc().get_business_data(module, "payload28", customer_code)
""" """
场景: 查询客户对应返利规则验证 场景: 查询客户对应返利规则验证
...@@ -49,10 +59,9 @@ request_body = commonFuc().get_business_data(module, "payload23", rebate_id) ...@@ -49,10 +59,9 @@ request_body = commonFuc().get_business_data(module, "payload23", rebate_id)
result = requests.post(url, json=request_body, headers=headers) result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content) result = json.loads(result.content)
# print(result) # print(result)
# 获取结果中返利规则id # 获取结果中返利规则中客户编码
result = {"rebateid": result["data"]["rebateid"]} result = {"customercode": result["data"][0]["customercode"]}
# 获取预期结果 # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict23", rebate_id) check_dict = commonFuc().get_business_data(module, "checkDict28", customer_code)
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) 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