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
86784e63
Commit
86784e63
authored
Dec 06, 2023
by
liguangyu06
Browse files
业务场景验证:新增商品下架拦截验证_下单
parent
4ac48e75
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_order_handle/商品下架拦截验证_下单_a.air/商品下架拦截验证_下单_a.py
0 → 100644
View file @
86784e63
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc商品下架拦截验证,2288,2288-24,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_order_handle"
# 第一步登录多采商城获取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 = 7991"
mysql_handle
.
executeUpdate
(
host
,
port
,
user
,
pwd
,
"cmdc-order"
,
sql
)
# 第二步进行提交订单
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url19"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload19"
)
"""
场景: 验证下单时,商品下架,是否进行拦截
用例名称:商品下架拦截验证
输出:{"message": "商品证照校验错误"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# print(result)
# 获取message
result
=
{
"message"
:
result
[
"message"
]}
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict19"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_handle/获取原订单信息接口验证_再来一单.air/获取原订单信息接口验证_再来一单.py
View file @
86784e63
...
...
@@ -22,9 +22,11 @@ password = commonFuc().get_business_data(module, "password")
cmdc_access_token
=
CmdcMaiiLogin
(
username
,
password
).
get_token
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers1"
,
cmdc_access_token
)
order_num
=
""
# 第二步获取多采商城需求单列表
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url_demand_list"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload_demand_list"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload_demand_list"
,
order_num
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
...
...
data/cmdc_order_handle/data
View file @
86784e63
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