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
c44575ed
Commit
c44575ed
authored
Apr 12, 2024
by
liguangyu06
Browse files
用例新增:发运日期排序功能验证_退货明细列表_降序
parent
65f5b764
Changes
1
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_34st/发运日期排序功能验证_退货明细列表_降序.air/发运日期排序功能验证_退货明细列表_降序.py
0 → 100644
View file @
c44575ed
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc发运日期排序功能验证_退货明细列表_降序,34,34-30,sit,be
主数据平台:后台运营系统获取退货明细列表接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
from
common.db.db
import
mySql
import
requests
import
json
module
=
"cmdc_34st"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username_do_be"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password_do_be"
)
# 获取登录后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
,
"url30"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload30"
)
"""
场景: 发运日期排序功能验证_退货明细列表_降序
用例名称:发运日期排序功能验证_退货明细列表_降序
输出:{"returnGoodCode":"%s"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取退货明细信息
result
=
json
.
loads
(
result
.
content
)
result
=
{
"returnGoodCode"
:
result
[
"data"
][
"list"
][
0
][
"returnGoodCode"
]}
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 数据库操作
mysql_handle
=
mySql
()
# 获取conf.ini文件中配置的数据库信息
host
,
port
,
user
,
pwd
=
mysql_handle
.
getConf
(
db
=
"cmdc_db_be"
)
# 在数据库中按发运日期降序查询对应的退货明细信息
sql
=
"select * "
\
"from (select de.SDDOCO, de.SDTRDJ, td.customerCode, td.customerName, de.SHIR01, de.SDPMPN, de.qwdsc, "
\
"sku.productCode,"
\
" sku.productName, sku.productLineCode, sku.productLineName, sku.measuringUnit, td.demandCode,"
\
" td.createTime, td.auditTime, td.distributionType, td.paymentType, main.paidTime, de.sdocto,"
\
" de.sdaddj, de.SDOORN from tc_jde_returnall_detail de"
\
" left join tc_demand td on de.demandCode = td.demandCode"
\
" left join tc_demand_sku sku on sku.demandCode = de.demandCode and "
\
"sku.lineNumber = de.demandLineNumber"
\
" left join tc_demand_main main on main.demandParentId = td.demandParentId"
\
" left join tc_manufacturer_user mu on mu.id = sku.manufacturerUserId"
\
" left join tc_manufacturer_product mp on mp.id = sku.manufacturerProductId"
\
" where de.sdocto != 'SN'"
\
" and td.demandId is not null"
\
" and td.sellerCompanyCode = '00102'"
\
" order by de.SDTRDJ desc) tmp_count order by sdaddj desc"
returnGoodCode
=
mysql_handle
.
selectSql
(
host
,
port
,
user
,
pwd
,
"cmdc-order"
,
sql
)[
0
][
0
]
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict30"
,
returnGoodCode
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
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