Commit cb373a2c authored by liguangyu06's avatar liguangyu06
Browse files

优化

parent 86fc0dad
......@@ -49,10 +49,17 @@ request_body = commonFuc().get_business_data(module, "payload19")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取订单中商品金额
result = {"productAmount": result["data"]["国药集团上海医疗器械有限公司"]["productAmount"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict22")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
if result["success"]:
# 获取订单中商品金额
result = {"productAmount": result["data"]["国药集团上海医疗器械有限公司"]["productAmount"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict22")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDictInvalid")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -64,12 +64,19 @@ request_body = commonFuc().get_business_data(module, "payload20", demand_id)
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取订单中商品金额
result = {"productAmount": result["data"]["国药集团上海医疗器械有限公司"]["datas"][0]["productAmount"]}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict21", amount_product)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
if result["success"]:
# 获取订单中商品金额
result = {"productAmount": result["data"]["国药集团上海医疗器械有限公司"]["datas"][0]["productAmount"]}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict21", amount_product)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDictInvalid")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -36,11 +36,11 @@ result = json.loads(result.content)
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_id = result["data"]["list"][random_demand]["demandId"]
# print(demand_id)
# 第三步获取原订单信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url18")
request_body = commonFuc().get_business_data(module, "payload18", demand_id)
# print(request_body)
"""
场景: 验证再来一单功能获取原订单信息接口连通性
用例名称:获取原订单信息接口验证_再来一单
......@@ -51,9 +51,17 @@ request_body = commonFuc().get_business_data(module, "payload18", demand_id)
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict18")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
if result["success"]:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict18")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDictInvalid")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -29,7 +29,7 @@ request_body = commonFuc().get_business_data(module, "payload13")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成一个随机数字,用于后续随机选择某一条商品属性信息
# 生成一个随机数字,用于后续随机选择某一条库存配置信息
rebate_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取库存配置信息
rule_id = result["data"]["list"][rebate_random]["stockRuleId"]
......
......@@ -87,7 +87,7 @@ url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url31")
request_body = {"manufacturerGroupName": "", "manufacturerGroupCode": "", "groupName": "", "limitPurchase": "",
"isLimit": 1, "freseniusGroup": fresenius_group, "groupStr": group_str, "customerCode": customer_code,
"userName": user_name, "customerName": customer_name, "isRegularPrice": 2}
print(request_body)
# print(request_body)
"""
场景: 单个新增验证_套包正价_指定客户
......@@ -98,7 +98,7 @@ print(request_body)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# print(result)
# 进行结果判断
if result["success"]:
......
......@@ -206,4 +206,8 @@ checkDict22: {"productAmount":"48.25"}
"url23": "/cms/mall/account/queryPageByCompanyId"
"payload23": {"pageSize":null,"pageNumber":null,"companyId":"%s"}
#预期结果
checkDict23: {"companyId":"%s"}
\ No newline at end of file
checkDict23: {"companyId":"%s"}
#商品无效断言结果
checkDictInvalid: {"success":false,"code":"ERROR","message":"当前订单无有效商品","data":null,"freshToken":null}
\ No newline at end of file
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