Commit 681269eb authored by liguangyu06's avatar liguangyu06
Browse files

优化

parent 4a49c4db
......@@ -21,39 +21,35 @@ username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
# 查询商品列表获取控销商品信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url50")
print(url)
request_body = commonFuc().get_business_data(module, "payload50")
print(request_body)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取商品信息并进行参数化处理
product_id = result["data"]["list"][0]["productId"]
print(product_id)
price = result["data"]["list"][0]["referencePrice"]
print(price)
# 第二步登录多彩商城添加控销商品至常购清单列表
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 添加控销商品至常购清单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url)
request_body = commonFuc().get_business_data(module, "payload5", product_id, price)
print(request_body)
"""
场景:新增控销商品至常购清单列表
用例名称:新增控销商品至常购清单列表
输出:{'success': False, 'code': 'addFrequentPurchaseFail', 'message': '商品为控销状态,不可加入常购清单', 'data': None, 'freshToken': None}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -21,39 +21,35 @@ username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
# 查询商品列表获取赠品_控销_商品信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url60")
print(url)
request_body = commonFuc().get_business_data(module, "payload60")
print(request_body)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取商品信息并进行参数化处理
product_id = result["data"]["list"][0]["productId"]
print(product_id)
price = result["data"]["list"][0]["referencePrice"]
print(price)
# 第二步登录多彩商城添加赠品_控销_商品至常购清单列表
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 添加赠品_控销_商品至常购清单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url)
request_body = commonFuc().get_business_data(module, "payload6", product_id, price)
print(request_body)
"""
场景:新增赠品_控销_商品至常购清单列表
用例名称:新增赠品_控销_商品至常购清单列表
输出:{'success': False, 'code': 'addFrequentPurchaseFail', 'message': '商品为控销状态,不可加入常购清单', 'data': None, 'freshToken': None}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -21,39 +21,35 @@ username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
# 查询商品列表获取赠品信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url70")
print(url)
request_body = commonFuc().get_business_data(module, "payload70")
print(request_body)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取商品信息并进行参数化处理
product_id = result["data"]["list"][0]["productId"]
print(product_id)
price = result["data"]["list"][0]["referencePrice"]
print(price)
# 第二步登录多彩商城添加赠品至常购清单列表
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 添加赠品至常购清单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url)
request_body = commonFuc().get_business_data(module, "payload7", product_id, price)
print(request_body)
"""
场景:新增赠品至常购清单列表
用例名称:新增赠品至常购清单列表
输出:{"success":true,"code":"200","message":"OK","data":"ok"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -21,11 +21,9 @@ username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
request_body1 = commonFuc().get_business_data(module, "payload90")
print(request_body1)
# 发送请求
result1 = requests.post(url, json=request_body1, headers=headers)
result1 = json.loads(result1.content)
......@@ -35,22 +33,22 @@ check_dict1 = commonFuc().get_business_data(module, "checkDict9")
print(check_dict1)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict1, result1)
# 组装跨站点商品报文
request_body = commonFuc().get_business_data(module, "payload91")
print(request_body)
"""
场景:跨站商品至常购清单列表
用例名称:跨站商品至常购清单列表
输出:{"success":true,"code":"200","message":"OK","data":"ok"}
输出:{"success":false,"code":"1078","message":"该商品不存在,加入购物车失败","data":null,"freshToken":null}
备注:目前常购清单列表不支持添加跨站点商品
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict9")
check_dict = commonFuc().get_business_data(module, "checkDict90")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -22,16 +22,15 @@ username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1",cmdc_access_token)
print(headers)
request_body = commonFuc().get_business_data(module, "payload2")
print(request_body)
"""
场景:获取用户常购清单列表
用例名称:获取用户常购清单列表
输出:{"success":true,"code":"200","message":"OK","data":"ok"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -19,30 +19,25 @@ username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
# 第二步获取客户列表
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
print(url2)
request_body2 = commonFuc().get_business_data(module, "payload2")
print(request_body2)
result2 = requests.post(url2, json=request_body2, headers=headers)
result2 = json.loads(result2.content)
print(result2)
user_no = result2["data"]["list"][0]["userNo"]
print(user_no)
# 第二步获取客户对应的商品列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url)
request_body = commonFuc().get_business_data(module, "payload1", user_no)
print(request_body)
"""
场景:获取商品列表(代客下单)
用例名称:获取商品列表(代客下单)
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -19,44 +19,38 @@ username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 第二步查询站点信息
url10 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url10")
print(url10)
request_body10 = commonFuc().get_business_data(module, "payload10")
print(request_body10)
# 发送请求
result10 = requests.post(url10, json=request_body10, headers=headers)
result10 = json.loads(result10.content)
print(result10)
# 获取站点companyId
company_id = result10["data"][2]["companyId"]
print(company_id)
# 第二步查询站点对应的JDEcode
url11 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url11")
print(url11)
request_body11 = commonFuc().get_business_data(module, "payload11", company_id)
print(request_body10)
# 发送请求
result11 = requests.get(url11, params=request_body11, headers=headers)
result11 = json.loads(result11.content)
print(result11)
company_code = result11["data"]["companyCode"]
print(company_code)
# 第四步切换站点
url12 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url12")
print(url12)
request_body12 = commonFuc().get_business_data(module, "payload12", company_id, company_code)
print(request_body12)
# 发送请求
result12 = requests.post(url12, json=request_body12, headers=headers)
result12 = json.loads(result12.content)
print(result12)
# 第四步查询站点对应的商品信息
url13 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url13")
print(url13)
"""
场景:获取商品列表(快速下单)
用例名称:获取商品列表(快速下单)
......
......@@ -21,11 +21,9 @@ username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
request_body = commonFuc().get_business_data(module, "payload2")
print(request_body)
"""
场景:获取客户列表(代客下单)
用例名称:获取客户列表(代客下单)
......
......@@ -21,16 +21,15 @@ username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1",cmdc_access_token)
print(headers)
request_body = commonFuc().get_business_data(module, "payload1")
print(request_body)
"""
场景:传入正确参数,获取到采购单列表
用例名称:获取采购单列表
输出:{"success":true,"code":"200","message":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -21,16 +21,15 @@ username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1",cmdc_access_token)
print(headers)
request_body = commonFuc().get_business_data(module, "payload1")
print(request_body)
"""
场景:传入正确参数,获取到客户列表
用例名称:获取客户列表
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -22,16 +22,15 @@ username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
request_body = commonFuc().get_business_data(module, "payload1")
print(request_body)
"""
场景:用户信息查询
用例名称:用户信息查询
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.get(url, headers=headers)
result = json.loads(result.content)
......
......@@ -22,16 +22,15 @@ username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
request_body = commonFuc().get_business_data(module, "payload2")
print(request_body)
"""
场景:站点切换
用例名称:站点切换
输出:{"success":true,"code":"200","message":"操作成功"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -22,11 +22,9 @@ username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
request_body = commonFuc().get_business_data(module, "payload1")
print(request_body)
"""
场景:获取站点信息
用例名称:获取站点信息
......
......@@ -180,8 +180,8 @@ checkDict300: {"success":true,"code":"200","message":"OK","data":"ok"}
#调整购物车中商品数量
"url80": "/product/mall/modifyBuyerCartQuantity"
"payload80": {"buyerCartId":"%s","modifyQuantity":"%s","subtotal":100}
"url83": "/product/mall/modifyBuyerCartQuantity"
"payload83": {"buyerCartId":"%s","modifyQuantity":"%s","subtotal":100}
#根据商品名称查询购物列表列表报文
"payload81": {"productName":"%s","materialCode":"","manufacturer":"","licenseCode":"","timeSortStatus":0,"pageSize":100,"pageStart":1}
#预期结果
......
#后台运营管理系统登录信息(总公司)
"username1": "admin1"
"password1": "Aa123456"
"username": "admin1"
"password": "Aa123456"
json_headers: {
"Content-Type": "application/json",
......
This diff is collapsed.
......@@ -25,7 +25,7 @@ checkDict1: {"success":true,"code":"200","message":"OK","data":1}
#测试场景二:重复拒绝同一个需求单
"payload2": {"demandId":"%d","auditStatus":2,"auditRemark":"审核拒绝原因"}
#预期结果
"checkDict2": {"success":false,"code":"demand","message":"订单已拒绝,无法重复拒绝","data":null,"freshToken":null}
"checkDict2": {"success":false,"code":"demand","message":"订单已提交过,请稍后操作","data":null,"freshToken":null}
#测试场景三:审核拒绝不存在的需求单
"payload3": {"demandId":"%s","auditStatus":2,"auditRemark":"#未首营平台取消#"}
......
......@@ -37,9 +37,9 @@ json_headers4: {
"Sourcetype": "mall"
}
"payload4": {"currentCompanyId":null,"productId":"%d","quantity":1,"agreementPriceId":0,"price":68.88}
"payload400": {"currentCompanyId":null,"productId":"%d","quantity":1,"agreementPriceId":0,"price":68.88}
#预期结果
checkDict4: {"success":false,"code":"1078","message":"该商品不存在,加入购物车失败","data":null,"freshToken":null}
checkDict400: {"success":false,"code":"1078","message":"该商品不存在,加入购物车失败","data":null,"freshToken":null}
......@@ -134,8 +134,8 @@ checkDict8: {'success': False, 'code': 'addFrequentPurchaseFail', 'message': '
"payload91": {"currentCompanyId":3,"productId":"25794","quantity":1,"agreementPriceId":0,"price":2800}
#预期结果
checkDict9: {'success': False, 'code': '1078', 'message': '该商品不存在,加入购物车失败', 'data': None, 'freshToken': None}
checkDict9: {"success":true,"code":"200","message":"OK","data":"ok"}
checkDict90: {"success":false,"code":"1078","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