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
fb7a8c06
Commit
fb7a8c06
authored
Nov 20, 2023
by
liguangyu06
Browse files
新增返利发放规则新增接口用例
parent
86035ba6
Changes
3
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_rebate/返利发放新增验证.air/返利发放新增验证.py
0 → 100644
View file @
fb7a8c06
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc返利发放新增验证,2271,2271-40,sit,bs
主数据平台:后台运营系统返利发放新增接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
from
common.db.db
import
mySql
import
requests
import
random
import
uuid
import
json
module
=
"cmdc_rebate"
# 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码
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
)
# 生成返利发放规则主题
theme
=
uuid
.
uuid4
()
# 生成可抵扣下单金额最高比例
use_limit
=
random
.
randint
(
1
,
99
)
# 第二步进行返利发放规则新增
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url43"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload43"
,
theme
,
use_limit
)
"""
场景: 返利发放新增验证
用例名称:返利发放新增验证
输出:{"rebateTheme":"%s"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# print(result)
if
result
[
"success"
]:
# 获取返利发放明细
rebate_trip_id
=
result
[
"data"
][
"rebateTripId"
]
rebate_theme
=
result
[
"data"
][
"rebateTheme"
]
print
(
rebate_trip_id
)
# 数据库操作
mysql_handle
=
mySql
()
# 获取conf.ini文件中配置的数据库信息
host
,
port
,
user
,
pwd
=
mysql_handle
.
getConf
(
db
=
"cmdc_db"
)
# 数据库查询返利发放规则主题
sql
=
"SELECT t.rebateTheme FROM `cmdc-order`.tc_rebatetrip t WHERE rebateTripId = {}"
.
format
(
rebate_trip_id
)
result
=
{
"rebateTheme"
:
mysql_handle
.
selectSql
(
host
,
port
,
user
,
pwd
,
"cmdc-order"
,
sql
)[
0
][
0
]}
# print(result)
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict43"
,
rebate_theme
)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
# 对新增的返利发放规则进行删除操作
sql
=
"DELETE FROM `cmdc-order`.tc_rebatetrip WHERE rebateTripId = {}"
.
format
(
rebate_trip_id
)
mysql_handle
.
executeUpdate
(
host
,
port
,
user
,
pwd
,
"cmdc-order"
,
sql
)
else
:
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict43_1"
)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
\ No newline at end of file
air_case/cmdc_rebate/返利发放明细获取验证.air/返利发放明细获取验证.py
View file @
fb7a8c06
...
@@ -50,7 +50,7 @@ host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
...
@@ -50,7 +50,7 @@ host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 数据库查询返利发放规则状态
# 数据库查询返利发放规则状态
sql
=
"SELECT t.rebateTripId FROM `cmdc-order`.tc_rebatetrip t"
sql
=
"SELECT t.rebateTripId FROM `cmdc-order`.tc_rebatetrip t"
result
=
{
"total"
:
len
(
mysql_handle
.
selectSql
(
host
,
port
,
user
,
pwd
,
"cmdc-order"
,
sql
)
[
0
]
)}
result
=
{
"total"
:
len
(
mysql_handle
.
selectSql
(
host
,
port
,
user
,
pwd
,
"cmdc-order"
,
sql
))}
# print(result)
# print(result)
# 核验数据库返利发放规则对应的删除标识是否正确
# 核验数据库返利发放规则对应的删除标识是否正确
# 获取预期结果
# 获取预期结果
...
...
data/cmdc_rebate/data
View file @
fb7a8c06
...
@@ -333,7 +333,12 @@ checkDict39_1: {"status":"%s"}
...
@@ -333,7 +333,12 @@ checkDict39_1: {"status":"%s"}
checkDict42: {"rebateTripId":"%s"}
checkDict42: {"rebateTripId":"%s"}
#测试场景四十六:返利发放新增验证
"url43": "/order/public/rebatetrip/addRebatetripVo"
"payload43": {"companyCode":"00111","invalidTimeStr":"2023-11-30","takeEffectTimeStr":"2023-11-20","rebateTheme":"%s","useLimitEnd":"%d","rebatetripProList":[{"commonName":"一次性使用灭菌橡胶外科手套","isSerialNumberManage":"N","measuringUnitName":"副","firstCategory":"医用耗材","specialSort":"0101","specifications":"SFTCS1145E 7.5 无粉麻面","productName":"一次性使用灭菌橡胶外科手套","isRelease":1,"newProductClassify2":"","productClassify":"6866","filialeCode":"00111","auxiliaryMeasuringUnit":"AS","medicineType":"","thirdCategory":"灭菌外科手套","serialNumber":"","productId":7439,"deleteSign":0,"otherStorageCondition":"10~50℃","dosageForm":"","manufacturerCode":"7007634","relevanceCode":"14479934","pricingMeasuringUnit":"AS","defaultImageUrl":"https://pro-cmdc.oss-cn-beijing.aliyuncs.com/productFile/2021/04/13/bb721764-a0ca-4ff7-9d63-778803bc0c68.jpg","productCategories":"01","atcClassify":"","isSee":0,"measuringUnit":"AS","applicationDepartment":"","secondCategoryId":450,"storageCondition":"002","status":101,"newRiskRank":"","secondCategory":"进口防护耗材","newClassifyLevel":"","isControlSales":0,"newProductClassify":"","description":"","lineName":"麦迪康","firstCategoryId":433,"thirdCategoryId":451,"manufacturer":"TG MEDICAL SDN. BHD.","lineCode":"2012","referencePrice":101,"relevanceName":"一次性使用灭菌橡胶外科手套","isGift":false,"jdeUpdateStr":"","keyWords":"一次性使用灭菌橡胶外科手套","atcCategories":"","riskRank":"002","materialCode":"SFTCS1145E-0040050","updateTime":"2023-10-30T14:20:31","productNature":"01","medicalInsuranceCode":"","uploadTime":"2023-10-30T06:20:31.000+0000","approvalNumber":"","jdeStatus":"P","filialeName":"","diagnosticMedicineCategories":"","productCode":"14479934","procurementMeasuringUnit":"AS","createTime":"2021-11-08T14:39:53","conSign":0,"sdOutStorage":0,"countryOfOrigin":"MY"}],"rebatetripCusList":[{"companyCode":"00111","customerCode":"-1887261","customerName":"河南通盛易达医用电子设备股份有限公司","grantAmount":"123","userId":134145,"useAmount":0}],"rebatetripAmountList":[{"companyCode":"00111","customerCode":"-1887261","customerName":"河南通盛易达医用电子设备股份有限公司","grantAmount":"123","userId":134145,"useAmount":0}]}
#预期结果
checkDict43: {"rebateTheme":"%s"}
checkDict43_1: {"success":false,"code":"11025","message":"商品:一次性使用灭菌橡胶外科手套存在其它返利规则中","data":null,"freshToken":null}
...
...
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