Skip to content
GitLab
Explore
Projects
Groups
Snippets
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
31c4d0ae
Commit
31c4d0ae
authored
1 year ago
by
liguangyu06
Browse files
Options
Download
Email Patches
Plain Diff
用例优化
parent
63eb1df4
main
master
1 merge request
!1
代码归档只main分支
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
air_case/cmdc_buyercar_list/新增已失效商品至购物车列表.air/新增已失效商品至购物车列表.py
+5
-1
...ase/cmdc_buyercar_list/新增已失效商品至购物车列表.air/新增已失效商品至购物车列表.py
air_case/cmdc_special_fresenius_group/启用_批量_特价单品.air/启用_批量_特价单品.py
+4
-5
...cmdc_special_fresenius_group/启用_批量_特价单品.air/启用_批量_特价单品.py
air_case/cmdc_special_fresenius_group/套包协议特价查询.air/套包协议特价查询.py
+3
-1
...ase/cmdc_special_fresenius_group/套包协议特价查询.air/套包协议特价查询.py
data/cmdc_special_fresenius_group/data
+1
-0
data/cmdc_special_fresenius_group/data
with
13 additions
and
7 deletions
+13
-7
air_case/cmdc_buyercar_list/新增已失效商品至购物车列表.air/新增已失效商品至购物车列表.py
+
5
-
1
View file @
31c4d0ae
...
...
@@ -12,7 +12,6 @@ from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 impor
import
requests
import
json
module
=
"cmdc_buyercar_list"
# 步骤一登录后台管理系统查询已失效商品列表获取已下架商品信息
...
...
@@ -22,14 +21,17 @@ password = commonFuc().get_business_data(module, "password2")
# 获取登录后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"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 获取商品信息
product_id
=
result
[
"data"
][
"list"
][
0
][
"productId"
]
price
=
result
[
"data"
][
"list"
][
0
][
"referencePrice"
]
filiale_code
=
result
[
"data"
][
"list"
][
0
][
"filialeCode"
]
# 第二步登录多采商城添加商品至购物车列表
# 获取登录多采商城所需账号密码
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
...
...
@@ -37,8 +39,10 @@ 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_headers5"
,
cmdc_access_token
)
# 添加商品至购物车
url1
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url2"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload5"
,
product_id
,
price
,
filiale_code
)
"""
场景:新增已失效的商品至购物车列表
用例名称:新增已失效的商品至购物车列表
...
...
This diff is collapsed.
Click to expand it.
air_case/cmdc_special_fresenius_group/启用_批量_特价单品.air/启用_批量_特价单品.py
+
4
-
5
View file @
31c4d0ae
...
...
@@ -50,7 +50,6 @@ excel.write_data(row=2, column=4, value=customer_name)
# 第二步文件导入
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url18"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload18"
)
# 获取文件
...
...
@@ -67,7 +66,7 @@ fresenius_price_id = result["data"]["freseniusAgreementPrices"][0]["freseniusPri
# 第三步进行特价单品删除操作
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url_open"
)
request_body
=
{
"freseniusPriceIds"
:
[
fresenius_price_id
],
"groupPriceStatus"
:
1
,
"remarks"
:
"特价单品启用"
}
print
(
request_body
)
"""
场景:启用_批量_特价单品
用例名称:启用_批量_特价单品
...
...
@@ -86,7 +85,8 @@ if result["success"]:
host
,
port
,
user
,
pwd
=
mysql_handle
.
getConf
(
db
=
"cmdc_db"
)
# 数据库查询特价单品数量
sql
=
"SELECT t.groupPriceStatus FROM `cmdc-order`.tc_fresenius_agreement_price t WHERE groupId = {};"
.
format
(
group_id
)
sql
=
"SELECT t.groupPriceStatus FROM `cmdc-order`.tc_fresenius_agreement_price t WHERE groupId = {};"
.
format
(
group_id
)
print
(
sql
)
result
=
{
"groupPriceStatus"
:
mysql_handle
.
selectSql
(
host
,
port
,
user
,
pwd
,
"cmdc-order"
,
sql
)[
0
][
0
]}
print
(
result
)
...
...
@@ -99,4 +99,4 @@ else:
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict180"
)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
\ No newline at end of file
commonFuc
().
check_result
(
check_dict
,
result
)
This diff is collapsed.
Click to expand it.
air_case/cmdc_special_fresenius_group/套包协议特价查询.air/套包协议特价查询.py
+
3
-
1
View file @
31c4d0ae
...
...
@@ -24,7 +24,7 @@ headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_toke
# 第二步套包协议特价查询
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url3"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload3"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload
0
3"
)
"""
场景:验证套包协议特价接口返回数据与数据库数据是否一致
用例名称:套包协议价查询
...
...
@@ -48,7 +48,9 @@ sql = "SELECT t.* FROM `cmdc-order`.tc_fresenius_agreement_price t " \
"WHERE companyCode = 00111 and isRegularPrice = 0 and "
\
"groupId in (SELECT t.groupId FROM `cmdc-order`.tc_fresenius_group t "
\
"WHERE status = 1 and groupType = 0);"
print
(
sql
)
total
=
len
(
mysql_handle
.
selectSql
(
host
,
port
,
user
,
pwd
,
"cmdc-order"
,
sql
))
print
(
total
)
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict3"
,
total
)
...
...
This diff is collapsed.
Click to expand it.
data/cmdc_special_fresenius_group/data
+
1
-
0
View file @
31c4d0ae
...
...
@@ -40,6 +40,7 @@ checkDict2: {"total":"%s"}
#测试场景三:套包协议特价查询
"url3": "/order/public/queryFreseniusAgreementPricePageInfo"
"payload3": {"groupCode":"","groupName":"","productCode":"","productInfo":"","materialCode":"","manufacturerList":[],"productLineName":"","description":"","manufacturerProductDesc":"","manufacturerProductNo":"","customerCode":"","customerName":"","manufacturerUserNo":"","manufacturerUserDesc":"","documentNo":"","companyCode":"","groupType":0,"status":null,"pageStart":null,"pageSize":null}
"payload03": {"groupCode":"","groupName":"","productCode":"","productInfo":"","materialCode":"","manufacturerList":[],"productLineName":"","description":"","manufacturerProductDesc":"","manufacturerProductNo":"","customerCode":"","customerName":"","manufacturerUserNo":"","manufacturerUserDesc":"","documentNo":"","companyCode":"","groupType":0,"status":"1","pageStart":1,"pageSize":10}
#预期结果
checkDict3: {"total":"%s"}
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets