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
e7c3c9bf
Commit
e7c3c9bf
authored
1 year ago
by
liguangyu06
Browse files
Options
Download
Email Patches
Plain Diff
业务场景验证:cmdc列表查询条件验证_发货时间列表
parent
21393c5c
main
master
1 merge request
!5
Master|更新商品模块和订单逆向模块用例
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
air_case/cmdc_product/列表查询条件验证_发货时间列表.air/列表查询条件验证_发货时间列表.py
+99
-0
air_case/cmdc_product/列表查询条件验证_发货时间列表.air/列表查询条件验证_发货时间列表.py
data/cmdc_product/data
+15
-3
data/cmdc_product/data
with
114 additions
and
3 deletions
+114
-3
air_case/cmdc_product/列表查询条件验证_发货时间列表.air/列表查询条件验证_发货时间列表.py
0 → 100644
+
99
-
0
View file @
e7c3c9bf
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc列表查询条件验证_发货时间列表,2293,2293-035,sit,bs
主数据平台:运营后台管理系统发货时间列表接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
random
import
json
module
=
"cmdc_product"
# 获取登录所需账号密码
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
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers"
,
cmdc_access_token
)
# 获取发货时间列表
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url34"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload34"
)
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成一个随机数
delivery_time_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 判断商品圈定方式
if
result
[
"data"
][
"list"
][
delivery_time_random
][
"productRangeType"
]:
# 当商品圈定方式为按商品时,进行商品相关字段查询验证
delivery_time_id
=
result
[
"data"
][
"list"
][
delivery_time_random
][
"deliveryTimeId"
]
# 通过查看发货时间详情获取商品信息
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url36"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload36"
,
delivery_time_id
)
# 发送请求
result1
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
result1
=
json
.
loads
(
result1
.
content
)
# 获取商品信息
line_codes
=
""
name
=
result1
[
"data"
][
"list"
][
delivery_time_random
][
"name"
]
status
=
result1
[
"data"
][
"list"
][
delivery_time_random
][
"status"
]
product_code
=
result1
[
"data"
][
"list"
][
delivery_time_random
][
"productList"
][
0
][
"productCode"
]
product_name
=
result1
[
"data"
][
"list"
][
delivery_time_random
][
"productList"
][
0
][
"productName"
]
# 进行查询条件验证
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url35"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload35"
,
line_codes
,
name
,
status
,
product_code
,
product_name
)
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# print(result)
# 获取查询结果中规则名称
result
=
{
"name"
:
result
[
"data"
][
"list"
][
0
][
"name"
]}
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict35"
,
name
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
else
:
# 当商品圈定方式为按产品线时,进行产品线相关字段查询验证
line_codes
=
result
[
"data"
][
"list"
][
delivery_time_random
][
"lineCodes"
]
name
=
result
[
"data"
][
"list"
][
delivery_time_random
][
"name"
]
status
=
result
[
"data"
][
"list"
][
delivery_time_random
][
"status"
]
product_code
=
""
product_name
=
""
# 进行查询条件验证
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url35"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload35"
,
line_codes
,
name
,
status
,
product_code
,
product_name
)
"""
场景: 列表查询条件验证_发货时间列表
用例名称:列表查询条件验证_发货时间列表
输出:{"name":"%s"}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# print(result)
# 获取查询结果中规则名称
result
=
{
"name"
:
result
[
"data"
][
"list"
][
0
][
"name"
]}
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict35"
,
name
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
This diff is collapsed.
Click to expand it.
data/cmdc_product/data
+
15
-
3
View file @
e7c3c9bf
...
...
@@ -243,13 +243,25 @@ checkDict32: {"success":true,"code":"200","message":"OK","data":"success","fresh
checkDict33: {"success":true,"code":"200","message":"OK","data":"success"}
#测试场景三十四:获取发货时间
"url34": "/product/deliveryTime/list"
"payload34": {"companyCode":null,"lineCodes":null,"name":null,"status":null,"productCode":null,"productName":null,"pageStart":1,"pageSize":10}
#预期结果
checkDict34: {"success":true,"code":"200","message":"OK"}
#测试场景三十五:列表查询条件验证_发货时间列表
"url35": "/product/deliveryTime/list"
"payload35": {"companyCode":null,"lineCodes":"%s","name":"%s","status":"%s","productCode":"%s","productName":"%s","pageStart":1,"pageSize":10}
#预期结果
checkDict35: {"name":"%s"}
#测试场景三十六:查看发货时间详情
"url36": "/product/deliveryTime/selectOne"
"payload36": {"id":"%s"}
#预期结果
checkDict36: {"id":"%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