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
6845223f
Commit
6845223f
authored
Dec 15, 2023
by
liguangyu06
Browse files
用例优化
parent
f640d958
Changes
8
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_frequent_purchase/常购清单列表商品移除.air/常购清单列表商品移除.py
View file @
6845223f
...
...
@@ -53,6 +53,7 @@ result2 = json.loads(result2.content)
# 第三步查询购物车中新增的商品信息
url3
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url2"
)
request_body3
=
commonFuc
().
get_business_data
(
module
,
"payload2"
)
# 发送请求
result3
=
requests
.
post
(
url3
,
json
=
request_body3
,
headers
=
headers
)
result3
=
json
.
loads
(
result3
.
content
)
# 获取购物车列表中商品对应的productId
...
...
air_case/cmdc_frequent_purchase/新增不存在的商品至常购清单列表.air/新增不存在的商品至常购清单列表.py
View file @
6845223f
...
...
@@ -16,8 +16,6 @@ import random
module
=
"cmdc_frequent_purchase"
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url1"
)
print
(
url
)
# 获取登录所需账号密码
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
...
...
@@ -26,6 +24,8 @@ cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers4"
,
cmdc_access_token
)
# 随机生成productId
product_id
=
random
.
randint
(
1000000000000
,
100000000000000
)
# 将商品添加至购物车列表
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url1"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload400"
,
product_id
)
"""
...
...
@@ -37,9 +37,9 @@ request_body = commonFuc().get_business_data(module, "payload400", product_id)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
print
(
result
)
#
print(result)
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict400"
)
print
(
check_dict
)
#
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_frequent_purchase/新增商品至常购清单列表.air/新增商品至常购清单列表.py
View file @
6845223f
...
...
@@ -25,6 +25,7 @@ headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_tok
# 第二步切换至子站点
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url2000"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload2000"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 添加商品至常购清单列表
...
...
air_case/cmdc_frequent_purchase/新增已失效商品至常购清单列表.air/新增已失效商品至常购清单列表.py
View file @
6845223f
...
...
@@ -45,6 +45,7 @@ headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_tok
# 第三步切换至子站点
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url2000"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload2001"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 第四步添加已失效商品至常购清单列表
...
...
air_case/cmdc_frequent_purchase/新增控销商品至常购清单列表.air/新增控销商品至常购清单列表.py
View file @
6845223f
...
...
@@ -22,6 +22,7 @@ password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token
=
CmdcDoLogin
(
username
,
password
).
get_token
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers"
,
cmdc_access_token
)
# 查询商品列表获取控销商品信息
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url50"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload50"
)
...
...
@@ -44,6 +45,7 @@ headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_tok
# 第三步切换至子站点
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url2000"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload2001"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 第四步添加控销商品至常购清单列表
...
...
air_case/cmdc_frequent_purchase/新增赠品至常购清单列表.air/新增赠品至常购清单列表.py
View file @
6845223f
...
...
@@ -44,6 +44,7 @@ headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_tok
# 第三步切换至子站点
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url2000"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload2001"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 第四步添加赠品至常购清单列表
...
...
air_case/cmdc_frequent_purchase/添加跨站点商品至常购清单列表.air/添加跨站点商品至常购清单列表.py
View file @
6845223f
...
...
@@ -57,6 +57,7 @@ headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_tok
# 切换至子站点
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url2000"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload2001"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 添加已商品至常购清单列表
...
...
@@ -81,6 +82,7 @@ commonFuc().check_result(check_dict, result)
# 切换至子站点
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url2000"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload2002"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 添加商品至常购清单列表
...
...
air_case/cmdc_frequent_purchase/获取用户常购清单列表.air/获取用户常购清单列表.py
View file @
6845223f
...
...
@@ -13,14 +13,16 @@ import json
module
=
"cmdc_frequent_purchase"
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url2"
)
# print(url)
# 获取登录所需账号密码
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
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers1"
,
cmdc_access_token
)
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers1"
,
cmdc_access_token
)
# 获取用户常购清单列表
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url2"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload2"
)
"""
...
...
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