Commit dad65db5 authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

1 merge request!4Master|需求单模块归档合并
Showing with 5 additions and 4 deletions
+5 -4
......@@ -23,7 +23,7 @@ cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
# 生成随机数据
random_code = random.randint(0, 10)
random_code = random.randint(0, 8)
# 第二步进行规格型号模糊匹配查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url10")
request_body = commonFuc().get_business_data(module, "payload10", random_code)
......@@ -40,6 +40,7 @@ result = json.loads(result.content)
# print(result)
# 获取查询结果中数据
result = {"data": result["data"][0][0]}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict10", random_code)
# print(check_dict)
......
......@@ -36,10 +36,10 @@ result = requests.post(url, headers=headers, json=request_body)
result = json.loads(result.content)
# 随机获取不相同两个商品信息
product_id_a = random.randint(1, len(result["data"]["list"]) - 1)
product_id_a = random.randint(1, len(result["data"]["list"]) - 2)
product_code_a = result["data"]["list"][product_id_a]["productCode"]
product_name_a = result["data"]["list"][product_id_a]["productName"]
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_code_b = result["data"]["list"][product_id_b]["productCode"]
product_name_b = result["data"]["list"][product_id_b]["productName"]
......
......@@ -49,7 +49,7 @@ result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取商品信息
product_detail = result["data"]["list"][random.randint(1, len(result["data"]["list"]))]
product_detail = result["data"]["list"][random.randint(1, len(result["data"]["list"]))-1]
product_detail["activityUnitAmount"] = customer_quantity
# 随机生成日期
......
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