Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
test
autotest-airtest-web-cmdc
Commits
5d34f784
Commit
5d34f784
authored
Sep 20, 2023
by
liguangyu06
Browse files
新增商品至常购清单列表用例优化
parent
84995805
Changes
2
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_frequent_purchase/新增商品至常购清单列表.air/新增商品至常购清单列表.py
View file @
5d34f784
...
...
@@ -8,15 +8,35 @@ case_tag:api,cmdc新增商品至常购清单列表,2252,2252-1,sit,bs
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.多彩商城登录.多彩商城登录
import
CmdcMaiiLogin
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
json
module
=
"cmdc_frequent_purchase"
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url1"
)
# 步骤一登录后台管理系统查询商品列表获取添加JDE已停用商品信息
# 获取登录后台管理系统所需账号密码
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
,
"url10"
)
print
(
url
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload10"
)
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"
)
...
...
@@ -25,7 +45,9 @@ 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
,
"payload1"
)
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url1"
)
print
(
url
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload1"
,
product_id
,
price
)
print
(
request_body
)
"""
场景:新增商品至常购清单列表
...
...
data/cmdc_frequent_purchase/data
View file @
5d34f784
# 多彩商城登录信息
"username": "Test001"
"password": "Aa123456"
#后台运营管理系统登录信息
"username1": "admin2"
"password1": "Aa123456"
json_headers: {
"Content-Type": "application/json",
"Cmdc_access_token": "%s"
}
#常购清单列表新增商品接口地址
...
...
@@ -12,8 +20,12 @@ json_headers1: {
"Sourcetype": "mall"
}
# 添加的商品不需要装机日期
"payload1": {"currentCompanyId":2,"productId":"9","quantity":1,"agreementPriceId":0,"price":68.88}
#查询已上架商品列表接口地址
"url10": "/product/mall/queryProductInfoByPage"
#查询已上架商品列表请求报文
"payload10": {"isFbList":0,"filialeCode":null,"productName":null,"productCode":null,"specifications":null,"materialCode":null,"manufacturer":null,"lineName":null,"riskRank":null,"isRelease":"1","isExistImage":null,"jdeStatus":"P","isGift":"0","description":null,"tbsj":[],"pageNum":1,"pageSize":8,"total":453,"firstQuery":true,"flag":true,"preInvalidStatus":null,"isControlSales":"0","startTime":null,"endTime":null,"status":101}
#添加商品至购物车报文
"payload1": {"currentCompanyId":null,"productId":"%d","quantity":1,"agreementPriceId":0,"price":"%d"}
#预期结果
checkDict1: {"success":true,"code":"200","message":"OK","data":"ok"}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment