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
248f656c
Commit
248f656c
authored
Nov 09, 2023
by
liguangyu06
Browse files
新增验证特价单品加入购物车用例
parent
0f610a6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_special_fresenius_group/特价单品加入购物车验证.air/特价单品加入购物车验证.py
0 → 100644
View file @
248f656c
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc验证特价单品加入购物车,2252,2252-71,sit,bs
涉及到接口:特价单品加入购物车接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.多采商城登录.多采商城登录
import
CmdcMaiiLogin
import
requests
import
json
module
=
"cmdc_special_fresenius_group"
# 第一步登录多采商城获取token信息
# 获取登录所需账号密码
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
)
# 进行站点切换
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url_website"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload_website"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 第四步特价单品加入购物车
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url43"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload43"
)
"""
场景:验证特价单品加入购物车功能
用例名称:验证特价单品加入购物车
输出:{"success":true,"code":"200","message":"OK","data":"ok","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
,
"checkDict43"
)
# # 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
data/cmdc_special_fresenius_group/data
View file @
248f656c
...
...
@@ -263,7 +263,11 @@ checkDict41: {"activityName":"每只特价101元,有效期2023-11-09至2031-12-3
#预期结果
checkDict42: {"purchaseQuantity":5}
#测试场景:特价单品加入购物车验证
"url43": "/product/mall/addBuyerCart"
"payload43": {"freseniusList":[{"currentCompanyId":6,"pSign":0,"productId":7438,"quantity":1,"agreementPriceId":0,"price":"101.0000","filialeCode":"00111","installedDate":null}],"groupProductType":1,"groupId":501,"currentCompanyId":6,"productId":7438,"pSign":0,"quantity":1,"agreementPriceId":0,"price":101,"filialeCode":"00111"}
#预期结果
checkDict43: {"success":true,"code":"200","message":"OK","data":"ok","freshToken":null}
...
...
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