Commit 080f0532 authored by liguangyu06's avatar liguangyu06
Browse files

优化

parent 4a9dfc99
...@@ -57,16 +57,23 @@ request_body = commonFuc().get_business_data(module, "payload6", product_id, reb ...@@ -57,16 +57,23 @@ request_body = commonFuc().get_business_data(module, "payload6", product_id, reb
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)
# 获取查询结果中商品code if result["success"]:
result = {"data": result["data"]} # 获取查询结果中商品code
result = {"data": result["data"]}
# 查询数据库中对应公司对应的商品属性id # 查询数据库中对应公司对应的商品属性id
sql = "SELECT t.propertyId FROM `cmdc-product`.ic_product_properties t WHERE companyCode = 00111 and deleteSign = 0 and productId ={}".format(product_id) sql = "SELECT t.propertyId FROM `cmdc-product`.ic_product_properties t WHERE companyCode = 00111 and deleteSign = 0 and productId ={}".format(product_id)
total = mysql_handle.selectSql(host, port, user, pwd, "cmdc-product", sql)[0][0] total = mysql_handle.selectSql(host, port, user, pwd, "cmdc-product", sql)[0][0]
# 获取预期结果 # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict6", total) check_dict = commonFuc().get_business_data(module, "checkDict6", total)
# print(check_dict) # print(check_dict)
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict6_1")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
...@@ -61,7 +61,7 @@ checkDict5: {"data":"%s"} ...@@ -61,7 +61,7 @@ checkDict5: {"data":"%s"}
"payload6": {"productId":"%s","propertyId":"","propertyName":"%s","propertyNote":"%s","propertyVal":"%s","productNameStr":"%s"} "payload6": {"productId":"%s","propertyId":"","propertyName":"%s","propertyNote":"%s","propertyVal":"%s","productNameStr":"%s"}
#预期结果 #预期结果
checkDict6: {"data":"%s"} checkDict6: {"data":"%s"}
checkDict6_1: {"success":false,"code":"product-pro-002","message":"该商品属性已经录入,不可重复录入","data":null,"freshToken":null}
......
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