Commit f1d8b210 authored by liguangyu06's avatar liguangyu06
Browse files

优化

parent 70730c49
...@@ -15,8 +15,8 @@ module = "cmdc_fresenius_group" ...@@ -15,8 +15,8 @@ module = "cmdc_fresenius_group"
# 第一步登录后台运营平台获取cmdc_access_token # 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码 # 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username1") username = commonFuc().get_business_data(module, "username4")
password = commonFuc().get_business_data(module, "password1") password = commonFuc().get_business_data(module, "password4")
# 获取登录后Cmdc_access_token # 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token() cmdc_access_token = CmdcDoLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token) headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
...@@ -27,22 +27,25 @@ request_body = commonFuc().get_business_data(module, "payload1") ...@@ -27,22 +27,25 @@ request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求 # 发送请求
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)
# 获取套包相关信息groupCode、groupName、productCode、productName、materialCode、manufacturerList、productLineName、description、productInfo # 获取套包相关信息groupCode、groupName、productCode、productName、materialCode、manufacturerList、productLineName、description、productInfo
group_code = result["data"]["list"][0]["groupCode"] group_code = result["data"]["list"][0]["groupCode"]
group_name = result["data"]["list"][0]["groupName"] group_name = result["data"]["list"][0]["groupName"]
product_code = result["data"]["list"][0]["products"][0]["productCode"] product_code = result["data"]["list"][0]["products"][0]["productCode"]
product_name = result["data"]["list"][0]["products"][0]["productName"] material_code = (result["data"]["list"][0]["products"][0]["materialCode"] if result["data"]["list"][0]["products"][0][
material_code = result["data"]["list"][0]["products"][0]["materialCode"] "materialCode"] else "")
manu_facturer = result["data"]["list"][0]["products"][0]["manufacturer"] manu_facturer = (result["data"]["list"][0]["products"][0]["manufacturer"] if result["data"]["list"][0]["products"][0][
product_line_name = result["data"]["list"][0]["productLineName"] "manufacturer"] else "")
description = result["data"]["list"][0]["products"][0]["description"] product_line_name = (result["data"]["list"][0]["productLineName"] if result["data"]["list"][0]["productLineName"] else "")
description = (result["data"]["list"][0]["products"][0]["description"] if result["data"]["list"][0]["products"][0][
"description"] else "")
product_info = result["data"]["list"][0]["products"][0]["productName"] product_info = result["data"]["list"][0]["products"][0]["productName"]
# 第三步进行套包列表查询条件验证 # 第三步进行套包列表查询条件验证
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url7") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url7")
request_body = commonFuc().get_business_data(module, "payload7", group_code, group_name, product_code, product_name, request_body = commonFuc().get_business_data(module, "payload7", group_code, group_name, product_code,
material_code, manu_facturer, product_line_name, description, product_info) material_code, manu_facturer, product_line_name, description, product_info)
# print(request_body)
""" """
场景:套包列表查询条件的验证 场景:套包列表查询条件的验证
用例名称:套包列表查询条件的验证 用例名称:套包列表查询条件的验证
...@@ -54,6 +57,7 @@ result = requests.post(url, json=request_body, headers=headers) ...@@ -54,6 +57,7 @@ result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间 # 获取接口响应时间
api_time = float(result.elapsed.total_seconds()) api_time = float(result.elapsed.total_seconds())
result = json.loads(result.content) result = json.loads(result.content)
# print(result)
result = {"productCode": result["data"]["list"][0]["products"][0]["productCode"]} result = {"productCode": result["data"]["list"][0]["products"][0]["productCode"]}
result["api_time"] = api_time result["api_time"] = api_time
# 获取预期结果 # 获取预期结果
......
...@@ -73,7 +73,7 @@ checkDict6: {"productCode":"%s"} ...@@ -73,7 +73,7 @@ checkDict6: {"productCode":"%s"}
#测试场景七:套包列表查询条件验证 #测试场景七:套包列表查询条件验证
"url7": "/order/public/queryFreseniusGroup" "url7": "/order/public/queryFreseniusGroup"
"payload7": {"groupCode":"%s","groupName":"%s","productCode":"%s","productName":"%s","materialCode":"%s","manufacturerList":["%s"],"productLineName":"%s","description":"%s","manufacturerProductDesc":"","manufacturerProductNo":"","companyCode":"","productInfo":"%s","status":null,"pageStart":1,"pageSize":10,"groupType":3} "payload7": {"groupCode":"%s","groupName":"%s","productCode":"%s","productName":"","materialCode":"%s","manufacturerList":["%s"],"productLineName":"%s","description":"%s","manufacturerProductDesc":"","manufacturerProductNo":"","companyCode":"","productInfo":"%s","status":null,"pageStart":1,"pageSize":10,"groupType":3}
#预期结果 #预期结果
checkDict7: {"productCode":"%s"} checkDict7: {"productCode":"%s"}
......
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