Commit 5dc81e0a authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

parent 27618d45
...@@ -44,7 +44,7 @@ request_body = commonFuc().get_business_data(module, "payload19") ...@@ -44,7 +44,7 @@ request_body = commonFuc().get_business_data(module, "payload19")
# 发送请求 # 发送请求
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)
# 获取message # 获取message
result = {"message": result["message"]} result = {"message": result["message"]}
# 获取预期结果 # 获取预期结果
......
...@@ -24,8 +24,10 @@ headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_toke ...@@ -24,8 +24,10 @@ headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_toke
# 第二步获取客户列表 # 第二步获取客户列表
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2") url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
request_body2 = commonFuc().get_business_data(module, "payload2") request_body2 = commonFuc().get_business_data(module, "payload2")
# 发送请求
result2 = requests.post(url2, json=request_body2, headers=headers) result2 = requests.post(url2, json=request_body2, headers=headers)
result2 = json.loads(result2.content) result2 = json.loads(result2.content)
# 获取客户列表中的客户信息
user_no = result2["data"]["list"][0]["userNo"] user_no = result2["data"]["list"][0]["userNo"]
# 第二步获取客户对应的商品列表 # 第二步获取客户对应的商品列表
......
...@@ -13,6 +13,8 @@ import json ...@@ -13,6 +13,8 @@ import json
module = "cmdc_product_list_query" module = "cmdc_product_list_query"
# 第一步登录多采商城获取cmdc_access_token # 第一步登录多采商城获取cmdc_access_token
# 获取登录所需账号密码 # 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username1") username = commonFuc().get_business_data(module, "username1")
...@@ -38,6 +40,7 @@ request_body11 = commonFuc().get_business_data(module, "payload11", company_id) ...@@ -38,6 +40,7 @@ request_body11 = commonFuc().get_business_data(module, "payload11", company_id)
# 发送请求 # 发送请求
result11 = requests.get(url11, params=request_body11, headers=headers) result11 = requests.get(url11, params=request_body11, headers=headers)
result11 = json.loads(result11.content) result11 = json.loads(result11.content)
# 获取站点信息
company_code = result11["data"]["companyCode"] company_code = result11["data"]["companyCode"]
# 第四步切换站点 # 第四步切换站点
...@@ -57,8 +60,6 @@ url13 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url13 ...@@ -57,8 +60,6 @@ url13 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url13
输出:{"success":true,"code":"200","message":"OK","data":"ok"} 输出:{"success":true,"code":"200","message":"OK","data":"ok"}
""" """
# 发送请求 # 发送请求
# request_body13 = commonFuc().get_business_data(module, "payload13")
# print(request_body13)
result = requests.get(url13, headers=headers) result = requests.get(url13, headers=headers)
result = json.loads(result.content) result = json.loads(result.content)
# 获取预期结果 # 获取预期结果
......
...@@ -14,14 +14,15 @@ import json ...@@ -14,14 +14,15 @@ import json
module = "cmdc_product_list_query" module = "cmdc_product_list_query"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
print(url)
# 获取登录所需账号密码 # 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username") username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password") password = commonFuc().get_business_data(module, "password")
# 获取登录后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)
# 获取客户列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
request_body = commonFuc().get_business_data(module, "payload2") request_body = commonFuc().get_business_data(module, "payload2")
""" """
......
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