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
ab438e82
Commit
ab438e82
authored
Mar 07, 2024
by
liguangyu06
Browse files
用例新增:通过code获取服务商品信息
parent
b8a1bd88
Changes
2
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_commodity_activity/通过code获取服务商品信息.air/通过code获取服务商品信息.py
0 → 100644
View file @
ab438e82
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc通过code获取服务商品信息,2262,2262-42,sit,bs
主数据平台:运营后台管理系统通过code获取服务商品信息接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
json
module
=
"cmdc_commodity_activity"
# 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码
username
=
commonFuc
().
get_business_data
(
module
,
"username30"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password30"
)
# 获取登录后Cmdc_access_token
cmdc_access_token
=
CmdcDoLogin
(
username
,
password
).
get_token
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers"
,
cmdc_access_token
)
# 第二步通过code获取服务商品信息
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url42"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload42"
)
"""
场景:通过code获取服务商品信息
用例名称:通过code获取服务商品信息
输出:{"companyCode":"00102"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
# 获取商品所属站点
result
=
json
.
loads
(
result
.
content
)
result
=
{
"companyCode"
:
result
[
"data"
][
0
][
"filialeCode"
]}
# 将接口响应时间添加至结果中
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict42"
)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
data/cmdc_commodity_activity/data
View file @
ab438e82
...
...
@@ -210,6 +210,11 @@ checkDict40: {"activityName": "%s"}
#预期结果
checkDict41: {"success":true,"code":"200","message":"OK"}
#测试场景42:通过code获取服务商品信息
"url42": "/product/public/queryServiceProductListByCompanyCode"
"payload42": {"companyCode":"00102"}
#预期结果
checkDict42: {"companyCode":"00102"}
...
...
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