From 0d59ae7eadcb8e5e0c3dac2df297bb61251d86ee Mon Sep 17 00:00:00 2001 From: liguangyu06 <1666071293@qq.com> Date: Tue, 21 Nov 2023 09:15:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E4=BE=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...24\345\210\251\346\270\205\345\215\225.py" | 21 ++++++++++--- ...42\346\210\267\346\270\205\345\215\225.py" | 24 +++++++++++---- ...01\351\273\221\345\220\215\345\215\225.py" | 21 ++++++++++--- ...42\346\210\267\350\214\203\345\233\264.py" | 19 ++++++++++-- ...77\347\224\250\346\230\216\347\273\206.py" | 30 ++++++++++++------- ...60\345\242\236\351\252\214\350\257\201.py" | 2 +- data/cmdc_rebate/data | 1 + 7 files changed, 89 insertions(+), 29 deletions(-) diff --git "a/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\344\275\277\347\224\250\345\225\206\345\223\201\350\277\224\345\210\251\346\270\205\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\344\275\277\347\224\250\345\225\206\345\223\201\350\277\224\345\210\251\346\270\205\345\215\225.py" "b/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\344\275\277\347\224\250\345\225\206\345\223\201\350\277\224\345\210\251\346\270\205\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\344\275\277\347\224\250\345\225\206\345\223\201\350\277\224\345\210\251\346\270\205\345\215\225.py" index a1017fb7..894b2f64 100644 --- "a/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\344\275\277\347\224\250\345\225\206\345\223\201\350\277\224\345\210\251\346\270\205\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\344\275\277\347\224\250\345\225\206\345\223\201\350\277\224\345\210\251\346\270\205\345\215\225.py" +++ "b/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\344\275\277\347\224\250\345\225\206\345\223\201\350\277\224\345\210\251\346\270\205\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\344\275\277\347\224\250\345\225\206\345\223\201\350\277\224\345\210\251\346\270\205\345\215\225.py" @@ -22,13 +22,26 @@ password = commonFuc().get_business_data(module, "password1") cmdc_access_token = CmdcDoLogin(username, password).get_token() headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token) -# 第二步获取获取可使用商品返利清单 -url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url35") -request_body = commonFuc().get_business_data(module, "payload35") +# 第二步获取返利发放明细 +url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url33") +request_body = commonFuc().get_business_data(module, "payload33") # 发送请求 result = requests.post(url, json=request_body, headers=headers) result = json.loads(result.content) +# 生成一个随机数 +rebate_random = random.randint(0, len(result["data"]["list"]) - 1) + +# 获取返利规则信息 +rebate_trip_td = result["data"]["list"][rebate_random]["rebateTripId"] + +# 第三步获取获取可使用商品返利清单列表 +url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url35") +request_body = commonFuc().get_business_data(module, "payload35", rebate_trip_td) +# 发送请求 +result = requests.post(url, json=request_body, headers=headers) +result = json.loads(result.content) +# print(result) # 生成一个随机数字 product_random = random.randint(0, len(result["data"]["list"]) - 1) # 获取获取可使用商品返利清单信息 @@ -37,7 +50,7 @@ product_code = result["data"]["list"][product_random]["productCode"] specifications = result["data"]["list"][product_random]["specifications"] manufacturer = result["data"]["list"][product_random]["manufacturer"] -# 第三步进行可使用商品返利清单查询 +# 第四步进行可使用商品返利清单查询 url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url36") request_body = commonFuc().get_business_data(module, "payload36", product_name, product_code, specifications, manufacturer) diff --git "a/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\345\217\221\346\224\276\345\256\242\346\210\267\346\270\205\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\345\217\221\346\224\276\345\256\242\346\210\267\346\270\205\345\215\225.py" "b/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\345\217\221\346\224\276\345\256\242\346\210\267\346\270\205\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\345\217\221\346\224\276\345\256\242\346\210\267\346\270\205\345\215\225.py" index a4e8c097..81230480 100644 --- "a/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\345\217\221\346\224\276\345\256\242\346\210\267\346\270\205\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\345\217\221\346\224\276\345\256\242\346\210\267\346\270\205\345\215\225.py" +++ "b/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\345\217\221\346\224\276\345\256\242\346\210\267\346\270\205\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\217\257\345\217\221\346\224\276\345\256\242\346\210\267\346\270\205\345\215\225.py" @@ -22,9 +22,22 @@ password = commonFuc().get_business_data(module, "password1") cmdc_access_token = CmdcDoLogin(username, password).get_token() headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token) -# 第二步获取获取可发放客户清单 +# 第二步获取返利发放明细 +url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url33") +request_body = commonFuc().get_business_data(module, "payload33") +# 发送请求 +result = requests.post(url, json=request_body, headers=headers) +result = json.loads(result.content) + +# 生成一个随机数 +rebate_random = random.randint(0, len(result["data"]["list"]) - 1) + +# 获取返利规则信息 +rebate_trip_td = result["data"]["list"][rebate_random]["rebateTripId"] + +# 第三步获取获取可发放客户清单 url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url37") -request_body = commonFuc().get_business_data(module, "payload37") +request_body = commonFuc().get_business_data(module, "payload37", rebate_trip_td) # 发送请求 result = requests.post(url, json=request_body, headers=headers) result = json.loads(result.content) @@ -35,10 +48,10 @@ product_random = random.randint(0, len(result["data"]["list"]) - 1) customer_name = result["data"]["list"][product_random]["customerName"] customer_code = result["data"]["list"][product_random]["customerCode"] -# 第三步进行可发放客户清单查询 +# 第四步进行可发放客户清单查询 url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url38") request_body = commonFuc().get_business_data(module, "payload38", customer_name, customer_code) - +print(request_body) """ 场景: 列表查询条件验证_可发放客户清单 用例名称:列表查询条件验证_可发放客户清单 @@ -48,7 +61,7 @@ request_body = commonFuc().get_business_data(module, "payload38", customer_name, # 发送请求 result = requests.post(url, json=request_body, headers=headers) result = json.loads(result.content) -# print(result) +print(result) # 获取查询结果中可发放客户清单信息 result = {"customerCode": result["data"]["list"][0]["customerCode"]} @@ -56,4 +69,3 @@ result = {"customerCode": result["data"]["list"][0]["customerCode"]} check_dict = commonFuc().get_business_data(module, "checkDict38", customer_code) # 断言实际结果中是否包含预期结果的内容 commonFuc().check_result(check_dict, result) - diff --git "a/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\225\206\345\223\201\351\273\221\345\220\215\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\225\206\345\223\201\351\273\221\345\220\215\345\215\225.py" "b/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\225\206\345\223\201\351\273\221\345\220\215\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\225\206\345\223\201\351\273\221\345\220\215\345\215\225.py" index de21acd7..c97ce0f6 100644 --- "a/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\225\206\345\223\201\351\273\221\345\220\215\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\225\206\345\223\201\351\273\221\345\220\215\345\215\225.py" +++ "b/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\225\206\345\223\201\351\273\221\345\220\215\345\215\225.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\225\206\345\223\201\351\273\221\345\220\215\345\215\225.py" @@ -22,13 +22,26 @@ password = commonFuc().get_business_data(module, "password1") cmdc_access_token = CmdcDoLogin(username, password).get_token() headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token) -# 第二步获取商品黑名单 -url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url11") -request_body = commonFuc().get_business_data(module, "payload11") +# 第二步获取返利规则 +url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3") +request_body = commonFuc().get_business_data(module, "payload3") # 发送请求 result = requests.post(url, json=request_body, headers=headers) result = json.loads(result.content) +# print(result) +# 生成一个随机数 +rebate_random = random.randint(0, len(result["data"]["list"]) - 1) +# 获取返利规则信息 +rebate_id = result["data"]["list"][rebate_random]["rebateid"] + +# 第三步获取商品黑名单 +url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url11") +request_body = commonFuc().get_business_data(module, "payload11", rebate_id) +# 发送请求 +result = requests.post(url, json=request_body, headers=headers) +result = json.loads(result.content) +# print(result) # 生成一个随机数字,用于后续随机选择商品 product_random = random.randint(0, len(result["data"]["list"]) - 1) # 获取商品黑名单中商品信息 @@ -37,7 +50,7 @@ product_code = result["data"]["list"][product_random]["productcode"] specifications = result["data"]["list"][product_random]["specifications"] manufacturer = result["data"]["list"][product_random]["manufacturer"] -# 第三步进行条件查询验证 +# 第四步进行条件查询验证 url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url12") request_body = commonFuc().get_business_data(module, "payload12", product_name, product_code, specifications, manufacturer) diff --git "a/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\256\242\346\210\267\350\214\203\345\233\264.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\256\242\346\210\267\350\214\203\345\233\264.py" "b/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\256\242\346\210\267\350\214\203\345\233\264.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\256\242\346\210\267\350\214\203\345\233\264.py" index 99ca7971..e15de4cd 100644 --- "a/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\256\242\346\210\267\350\214\203\345\233\264.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\256\242\346\210\267\350\214\203\345\233\264.py" +++ "b/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\256\242\346\210\267\350\214\203\345\233\264.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\345\256\242\346\210\267\350\214\203\345\233\264.py" @@ -22,9 +22,22 @@ password = commonFuc().get_business_data(module, "password1") cmdc_access_token = CmdcDoLogin(username, password).get_token() headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token) -# 第二步获取返利规则对应的客户范围 +# 第二步获取返利规则 +url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3") +request_body = commonFuc().get_business_data(module, "payload3") +# 发送请求 +result = requests.post(url, json=request_body, headers=headers) +result = json.loads(result.content) + +# 生成一个随机数 +rebate_random = random.randint(0, len(result["data"]["list"]) - 1) + +# 获取返利规则信息 +rebate_id = result["data"]["list"][rebate_random]["rebateid"] + +# 第三步获取返利规则对应的客户范围 url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url13") -request_body = commonFuc().get_business_data(module, "payload13") +request_body = commonFuc().get_business_data(module, "payload13", rebate_id) # 发送请求 result = requests.post(url, json=request_body, headers=headers) result = json.loads(result.content) @@ -35,7 +48,7 @@ customer_random = random.randint(0, len(result["data"]["list"]) - 1) customer_name = result["data"]["list"][customer_random]["customername"] customer_code = result["data"]["list"][customer_random]["customercode"] -# 第三步进行条件查询验证 +# 第四步进行条件查询验证 url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url14") request_body = commonFuc().get_business_data(module, "payload14", customer_name, customer_code) """ diff --git "a/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\350\277\224\345\210\251\344\275\277\347\224\250\346\230\216\347\273\206.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\350\277\224\345\210\251\344\275\277\347\224\250\346\230\216\347\273\206.py" "b/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\350\277\224\345\210\251\344\275\277\347\224\250\346\230\216\347\273\206.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\350\277\224\345\210\251\344\275\277\347\224\250\346\230\216\347\273\206.py" index 75a83849..b9d8736f 100644 --- "a/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\350\277\224\345\210\251\344\275\277\347\224\250\346\230\216\347\273\206.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\350\277\224\345\210\251\344\275\277\347\224\250\346\230\216\347\273\206.py" +++ "b/air_case/cmdc_rebate/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\350\277\224\345\210\251\344\275\277\347\224\250\346\230\216\347\273\206.air/\345\210\227\350\241\250\346\237\245\350\257\242\346\235\241\344\273\266\351\252\214\350\257\201_\350\277\224\345\210\251\344\275\277\347\224\250\346\230\216\347\273\206.py" @@ -41,14 +41,14 @@ def func(x): # 生成一个随机数字,用于后续随机选择某一条返利使用明细 -rebate_random = random.randint(0, len(result["data"]["list"]) - 1) +rebate_random = random.randint(1, len(result["data"]["list"]) - 1) # 获取返利使用明细列表中某一条明细信息 customer_code = result["data"]["list"][rebate_random]["customerCode"] -customer_name = result["data"]["list"][rebate_random]["customerName"] +customer_name = func(result["data"]["list"][rebate_random]["customerName"]) relevance_name = result["data"]["list"][rebate_random]["relevanceName"] transaction_type = result["data"]["list"][rebate_random]["transactionType"] -rebate_id = result["data"]["list"][rebate_random]["rebateId"] -rebate_name = result["data"]["list"][rebate_random]["rebateName"] +rebate_id = func(result["data"]["list"][rebate_random]["rebateId"]) +rebate_name = func(result["data"]["list"][rebate_random]["rebateName"]) list_order_status = func(result["data"]["list"][rebate_random]["orderStatus"]) demand_code = func(result["data"]["list"][rebate_random]["demandCode"]) start_time = result["data"]["list"][rebate_random]["createTimeStr"] @@ -61,7 +61,7 @@ request_body = commonFuc().get_business_data(module, "payload2", customer_code, transaction_type, rebate_id, rebate_name, list_order_status, demand_code, start_time, end_time) - +# print(request_body) """ 场景: 验证返利使用明细列表查询条件是否可以正常使用 用例名称:列表查询条件验证_返利使用明细 @@ -72,9 +72,17 @@ request_body = commonFuc().get_business_data(module, "payload2", customer_code, result = requests.post(url, json=request_body, headers=headers) result = json.loads(result.content) print(result) -# 获取查询结果中使用明细对应的客户编号 -result = {"customerCode": result["data"]["list"][0]["customerCode"]} -# 获取预期结果 -check_dict = commonFuc().get_business_data(module, "checkDict2", customer_code) -# 断言实际结果中是否包含预期结果的内容 -commonFuc().check_result(check_dict, result) +if result["data"]["list"]: + # 获取查询结果中使用明细对应的客户编号 + result = {"customerCode": result["data"]["list"][0]["customerCode"]} + # 获取预期结果 + check_dict = commonFuc().get_business_data(module, "checkDict2", customer_code) + # 断言实际结果中是否包含预期结果的内容 + commonFuc().check_result(check_dict, result) +else: + # 获取查询结果中使用明细对应的客户编号 + result = {"list": result["data"]["list"]} + # 获取预期结果 + check_dict = commonFuc().get_business_data(module, "checkDict2_1") + # 断言实际结果中是否包含预期结果的内容 + commonFuc().check_result(check_dict, result) diff --git "a/air_case/cmdc_special_fresenius_group/\346\226\260\350\200\201\345\225\206\345\223\201\345\205\263\347\263\273\347\274\226\347\240\201\347\273\264\346\212\244\346\226\260\345\242\236\351\252\214\350\257\201.air/\346\226\260\350\200\201\345\225\206\345\223\201\345\205\263\347\263\273\347\274\226\347\240\201\347\273\264\346\212\244\346\226\260\345\242\236\351\252\214\350\257\201.py" "b/air_case/cmdc_special_fresenius_group/\346\226\260\350\200\201\345\225\206\345\223\201\345\205\263\347\263\273\347\274\226\347\240\201\347\273\264\346\212\244\346\226\260\345\242\236\351\252\214\350\257\201.air/\346\226\260\350\200\201\345\225\206\345\223\201\345\205\263\347\263\273\347\274\226\347\240\201\347\273\264\346\212\244\346\226\260\345\242\236\351\252\214\350\257\201.py" index f91cf50a..a9d7a134 100644 --- "a/air_case/cmdc_special_fresenius_group/\346\226\260\350\200\201\345\225\206\345\223\201\345\205\263\347\263\273\347\274\226\347\240\201\347\273\264\346\212\244\346\226\260\345\242\236\351\252\214\350\257\201.air/\346\226\260\350\200\201\345\225\206\345\223\201\345\205\263\347\263\273\347\274\226\347\240\201\347\273\264\346\212\244\346\226\260\345\242\236\351\252\214\350\257\201.py" +++ "b/air_case/cmdc_special_fresenius_group/\346\226\260\350\200\201\345\225\206\345\223\201\345\205\263\347\263\273\347\274\226\347\240\201\347\273\264\346\212\244\346\226\260\345\242\236\351\252\214\350\257\201.air/\346\226\260\350\200\201\345\225\206\345\223\201\345\205\263\347\263\273\347\274\226\347\240\201\347\273\264\346\212\244\346\226\260\345\242\236\351\252\214\350\257\201.py" @@ -31,7 +31,7 @@ result = json.loads(result.content) # 随机获取不相同两个商品信息 product_id_a = random.randint(1, len(result["data"]["list"]) - 2) product_a = result["data"]["list"][product_id_a] -product_id_b = random.randint(product_id_a + 1, len(result["data"]["list"])) +product_id_b = random.randint(product_id_a + 1, len(result["data"]["list"])-1) product_b = result["data"]["list"][product_id_b] # 第二步进行新老商品关系编码维护新增 diff --git a/data/cmdc_rebate/data b/data/cmdc_rebate/data index 0b8b3497..3202a5e5 100644 --- a/data/cmdc_rebate/data +++ b/data/cmdc_rebate/data @@ -35,6 +35,7 @@ checkDict1: {"success":true,"code":"200","message":"OK"} "payload2": {"terminalSign":1,"companyName":null,"customerCode":"%s","customerName":"%s","relevanceName":"%s","transactionType":"%s","relevanceCode":null,"rebateId":"%s","rebateName":"%s","listOrderStatus":["%s"],"demandCode":"%s","startTime":"%s","endTime":"%s","pageNum":1,"pageSize":10} #预期结果 checkDict2: {"customerCode":"%s"} +checkDict2_1: {"list":[]} #测试场景三:返利规则获取验证 "url3": "/order/rebate/getList" -- GitLab