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
d42ad665
Commit
d42ad665
authored
Dec 13, 2023
by
liguangyu06
Browse files
用例新增:商品下架拦截验证_订单修改
parent
ef705ceb
Changes
2
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_demand_mall/商品下架拦截验证_订单修改.air/商品下架拦截验证_订单修改.py
0 → 100644
View file @
d42ad665
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc商品下架拦截验证_订单修改,2289,2289-37,sit,bs
涉及到接口:多采商城需求单修改接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.多采商城登录.多采商城登录
import
CmdcMaiiLogin
from
common.db.db
import
mySql
import
requests
import
json
module
=
"cmdc_demand_mall"
# 第一步登录多采商城获取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
)
# 数据库操作
mysql_handle
=
mySql
()
# 获取conf.ini文件中配置的数据库信息
host
,
port
,
user
,
pwd
=
mysql_handle
.
getConf
(
db
=
"cmdc_db"
)
# 进行商品下架操作
sql
=
"UPDATE `cmdc-product`.ic_product t SET t.status = 102 WHERE t.productId = 314"
mysql_handle
.
executeUpdate
(
host
,
port
,
user
,
pwd
,
"cmdc-product"
,
sql
)
# 第二步需求单编辑修改操作
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url39"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload39"
)
"""
场景: 验证需求单编辑提交时,所含商品下架,是否被拦截成功
用例名称:商品下架拦截验证_订单修改
输出:{"errMessage": "红外测温仪商品已被下架,请返回重新提交。"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# print(result)
# 获取message
result
=
{
"errMessage"
:
result
[
"data"
][
0
][
"errMessage"
]}
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict39"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
# 进行商品上架架操作
sql
=
"UPDATE `cmdc-product`.ic_product t SET t.status = 101 WHERE t.productId = 314"
mysql_handle
.
executeUpdate
(
host
,
port
,
user
,
pwd
,
"cmdc-product"
,
sql
)
\ No newline at end of file
log/runtime.txt
View file @
d42ad665
控销
商品拦截验证_
再来一单_d 1701847135259 1701847140102
liguangyu
商品
下架
拦截验证_
订单修改 1702431554548 1702431564240
liguangyu
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