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
5271a37a
Commit
5271a37a
authored
Jun 17, 2024
by
周念东
Browse files
20240617
parents
ced008e1
c3acdd56
Changes
950
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
20 of 950+
files are displayed.
Plain diff
Email patch
air_case/cmdc_order_list/勾选合并_jde配货管理.air/勾选合并_jde配货管理.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc勾选合并_jde配货管理,2295,2295-18,sit,bs
主数据平台:后台运营系统合并接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
random
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后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
,
"url20_1"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload20_1"
)
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
dis_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取配货单信息
distribution_jde_ds_id
=
result
[
"data"
][
"list"
][
dis_random
][
"distributionJdeDsId"
]
# 第三步进行合并操作
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url20"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload20"
,
distribution_jde_ds_id
)
"""
场景: 勾选合并_jde配货管理
用例名称:勾选合并_jde配货管理
输出:{"distributionJdeDsId":"%s"}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取合并页面中的distributionJdeDsId
result
=
json
.
loads
(
result
.
content
)
result
=
{
"distributionJdeDsId"
:
result
[
"data"
][
"before"
][
"distributionJdeDsDetailList"
][
0
][
"distributionJdeDsId"
]}
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict20"
,
distribution_jde_ds_id
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/合并已推送配货单校验验证_jde配货管理.air/合并已推送配货单校验验证_jde配货管理.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc合并已推送配货单校验验证,2295,2295-19,sit,bs
主数据平台:后台运营系统合并接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
random
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后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
,
"url19_1"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload19_1"
)
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
dis_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取配货单信息
distribution_jde_ds_id
=
result
[
"data"
][
"list"
][
dis_random
][
"distributionJdeDsId"
]
distribution_jde_ds_code
=
result
[
"data"
][
"list"
][
dis_random
][
"distributionJdeDsCode"
]
# 第三步进行合并操作
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url19"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload19"
,
distribution_jde_ds_id
)
"""
场景: 合并已推送配货单校验验证
用例名称:合并已推送配货单校验验证
输出:{"success":false,"code":"ERROR","message":"%s配货状态错误","data":null,"freshToken":null}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
result
=
json
.
loads
(
result
.
content
)
# print(result)
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict19"
,
distribution_jde_ds_code
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/同步SO接口验证.air/同步SO接口验证.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc同步SO接口验证,2295,2295-124,sit,bs
主数据平台:后台运营系同步SO接口接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后Cmdc_access_token
cmdc_access_token
=
CmdcDoLogin
(
username
,
password
).
get_token
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers"
,
cmdc_access_token
)
# 第二步同步SO接口
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url124"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload124"
)
"""
场景: 同步SO接口验证
用例名称:同步SO接口验证
输出:{"success":true,"code":"200","message":null,"data":null,"freshToken":null}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
result
=
json
.
loads
(
result
.
content
)
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict124"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/商品清单筛选功能验证_欠货详情.air/商品清单筛选功能验证_欠货详情.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc商品清单筛选功能验证_欠货详情,2295,2295-123,sit,bs
主数据平台:后台运营系统获取欠货详情接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
random
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后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
,
"url118"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload118"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
debt_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"queryDemandPageInfo"
][
"list"
])
-
1
)
# 获取欠货信息
customerCode
=
result
[
"data"
][
"queryDemandPageInfo"
][
"list"
][
debt_random
][
"customerCode"
]
demandId
=
result
[
"data"
][
"queryDemandPageInfo"
][
"list"
][
debt_random
][
"demandId"
]
demandSubId
=
result
[
"data"
][
"queryDemandPageInfo"
][
"list"
][
debt_random
][
"demandSubId"
]
# 第三步获取欠货详情
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url120"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload120"
,
demandSubId
,
demandSubId
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 获取欠货详情商品信息
orderMark
=
result
[
"data"
][
"list"
][
0
][
"orderMark"
]
manufacturer
=
result
[
"data"
][
"list"
][
0
][
"manufacturer"
]
productName
=
result
[
"data"
][
"list"
][
0
][
"productName"
]
materialCode
=
result
[
"data"
][
"list"
][
0
][
"materialCode"
]
productCode
=
result
[
"data"
][
"list"
][
0
][
"productCode"
]
optionStr
=
result
[
"data"
][
"list"
][
0
][
"optionStr"
]
# 第四步进行商品清单筛选查询
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url123"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload123"
,
demandId
,
demandSubId
,
orderMark
,
manufacturer
,
productName
,
materialCode
,
productCode
,
optionStr
)
"""
场景: 商品清单筛选功能验证_欠货详情
用例名称:商品清单筛选功能验证_欠货详情
输出:{"productCode":"%s"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取商品清单信息
result
=
json
.
loads
(
result
.
content
)
result
=
{
"productCode"
:
result
[
"data"
][
"list"
][
0
][
"productCode"
]}
# 将接口响应时间添加至结果中
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict123"
,
productCode
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/商品行明细导出验证_订单维度_欠货综合管理.air/商品行明细导出验证_订单维度_欠货综合管理.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc商品行明细导出验证_订单维度_欠货综合管理,2295,2295-119,sit,bs
主数据平台:后台运营系统商品行明细导出接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
from
common.handle_excel
import
HandleExcel
import
requests
import
random
import
json
import
os
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后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
,
"url118"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload118"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
debt_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"queryDemandPageInfo"
][
"list"
])
-
1
)
# 获取欠货信息
demandParentCode
=
result
[
"data"
][
"queryDemandPageInfo"
][
"list"
][
debt_random
][
"demandParentCode"
]
# 第三步进行商品明细导出
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url119"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload119"
,
demandParentCode
)
"""
场景: 商品行明细导出验证_订单维度_欠货综合管理
用例名称:商品行明细导出验证_订单维度_欠货综合管理
输出:{"demandParentCode":"%s"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取文件
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))))
file_path
=
BASE_DIR
+
"/data/cmdc_files/欠货商品行明细.xlsx"
# 获取到导出文件存入cmdc_files文件中
with
open
(
file_path
,
'wb'
)
as
f
:
f
.
write
(
result
.
content
)
# 获取导出文件中需求单号
excel
=
HandleExcel
(
file_path
,
"Sheet1"
)
# print(excel.read_data())
result
=
{
"demandParentCode"
:
excel
.
read_data
()[
0
].
get
(
"母需求单编号"
)}
# 将接口响应时间添加至结果中
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict119"
,
demandParentCode
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/字段值有效性校验_查看采购单详情.air/字段值有效性校验_查看采购单详情.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc字段值有效性校验_查看采购单详情,2295,2295-14,sit,bs
主数据平台:后台运营系统查询采购单详情信息接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
random
import
requests
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取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
)
# 随机生成purchaseId
id_random
=
random
.
randint
(
11111111
,
11111111111
)
# 第二步查看采购单详情信息
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url14"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload14"
,
id_random
)
"""
场景: 字段值有效性校验_查看采购单详情
用例名称:字段值有效性校验_查看采购单详情
输出:{"success":false,"code":"order-pur-001","message":"采购单单据不存在或已被删除","data":null,"freshToken":null}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
result
=
json
.
loads
(
result
.
content
)
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict14"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/客户信息为空_通过Excel添加商品_代客下单.air/客户信息为空_通过Excel添加商品_代客下单.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc客户信息为空_通过Excel添加商品_代客下单,2295,2295-50,sit,bs
主数据平台:后台运营系统查询采购单详情信息接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后Cmdc_access_token
cmdc_access_token
=
CmdcDoLogin
(
username
,
password
).
get_token
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers"
,
cmdc_access_token
)
# 第二步通过Excel添加商品
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url47"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload47"
)
"""
场景: 客户信息为空_通过Excel添加商品_代客下单
用例名称:客户信息为空_通过Excel添加商品_代客下单
输出:{"success":false,"code":"ERROR","message":"用户信息不完整","data":null,"freshToken":null}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
result
=
json
.
loads
(
result
.
content
)
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict47"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/导出功能验证_商品清单.air/导出功能验证_商品清单.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc导出功能验证_商品清单,2295,2295-91,sit,bs
主数据平台:后台运营系统获取客户商品列表接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
from
common.handle_excel
import
HandleExcel
import
requests
import
json
import
random
import
os
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后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
,
"url87"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload87"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
product_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取商品信息
productInfo
=
result
[
"data"
][
"list"
][
product_random
][
"productCode"
]
# 第三步进行商品清单导出操作
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url91"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload91"
,
productInfo
)
"""
场景: 导出功能验证_商品清单
用例名称:导出功能验证_商品清单
输出:{"productInfo":"%s"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取文件
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))))
file_path
=
BASE_DIR
+
"/data/cmdc_files/商品清单.xlsx"
# 获取到导出文件存入cmdc_files文件中
with
open
(
file_path
,
'wb'
)
as
f
:
f
.
write
(
result
.
content
)
# 获取导出文件中商品编码
excel
=
HandleExcel
(
file_path
,
"Sheet1"
)
# print(excel.read_data())
result
=
{
"productInfo"
:
excel
.
read_data
()[
0
].
get
(
"商品编码"
)}
# 将接口响应时间添加至结果中
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict91"
,
productInfo
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/导出功能验证_商品预测明细.air/导出功能验证_商品预测明细.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc导出功能验证_商品预测明细,2295,2295-85,sit,bs
主数据平台:后台运营系统商品预测明细导出接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
from
common.handle_excel
import
HandleExcel
import
requests
import
random
import
json
import
os
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后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
,
"url83"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload83"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
pr_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取商品信息
customerInfo
=
result
[
"data"
][
"list"
][
pr_random
][
"customerCode"
]
# 第三步商品预测明细导出操作
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url85"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload85"
,
customerInfo
)
"""
场景: 导出功能验证_商品预测明细
用例名称:导出功能验证_商品预测明细
输出:{"customerInfo":"%s"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取文件
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))))
file_path
=
BASE_DIR
+
"/data/cmdc_files/商品预测明细导出.xlsx"
# 获取到导出文件存入cmdc_files文件中
with
open
(
file_path
,
'wb'
)
as
f
:
f
.
write
(
result
.
content
)
# 获取导出文件中客户编码
excel
=
HandleExcel
(
file_path
,
"Sheet1"
)
# print(excel.read_data())
result
=
{
"customerInfo"
:
excel
.
read_data
()[
0
].
get
(
"客户编码"
)}
# 将接口响应时间添加至结果中
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict85"
,
customerInfo
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/导出功能验证_客户清单.air/导出功能验证_客户清单.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc导出功能验证_客户清单,2295,2295-89,sit,bs
主数据平台:后台运营系统客户清单导出接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
from
common.handle_excel
import
HandleExcel
import
requests
import
json
import
random
import
os
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后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
,
"url86"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload86"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
customer_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取客户信息
customerInfo
=
result
[
"data"
][
"list"
][
customer_random
][
"customerCode"
]
# 第三步客户清单导出操作
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url89"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload89"
,
customerInfo
)
"""
场景: 导出功能验证_客户清单
用例名称:导出功能验证_客户清单
输出:{"customerInfo":"%s"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取文件
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))))
file_path
=
BASE_DIR
+
"/data/cmdc_files/客户清单.xlsx"
# 获取到导出文件存入cmdc_files文件中
with
open
(
file_path
,
'wb'
)
as
f
:
f
.
write
(
result
.
content
)
# 获取导出文件中客户编码
excel
=
HandleExcel
(
file_path
,
"Sheet1"
)
# print(excel.read_data())
result
=
{
"customerInfo"
:
excel
.
read_data
()[
0
].
get
(
"客户编码"
)}
# 将接口响应时间添加至结果中
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict89"
,
customerInfo
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/导出功能验证_客户采购计划.air/导出功能验证_客户采购计划.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc导出功能验证_客户采购计划,2295,2295-81,sit,bs
主数据平台:后台运营系统客户采购计划导出接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
from
common.handle_excel
import
HandleExcel
import
random
import
requests
import
json
import
os
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后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
,
"url79"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload79"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
pro_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取客户采购计划信息
customerInfo
=
result
[
"data"
][
"list"
][
pro_random
][
"customerCode"
]
# 第三步进行客户采购计划导出操作
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url81"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload81"
,
customerInfo
)
"""
场景: 导出功能验证_客户采购计划
用例名称:导出功能验证_客户采购计划
输出:{"customerCode":"%s"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取文件
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))))
file_path
=
BASE_DIR
+
"/data/cmdc_files/采购计划汇总导出.xlsx"
# 获取到导出文件存入cmdc_files文件中
with
open
(
file_path
,
'wb'
)
as
f
:
f
.
write
(
result
.
content
)
# 获取导出文件中客户编码
excel
=
HandleExcel
(
file_path
,
"Sheet1"
)
# print(excel.read_data())
result
=
{
"customerCode"
:
excel
.
read_data
()[
0
].
get
(
"客户编码"
)}
# 将接口响应时间添加至结果中
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict81"
,
customerInfo
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/导出功能验证_终端流向.air/导出功能验证_终端流向.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc导出功能验证_终端流向,2295,2295-62,sit,bs
主数据平台:后台运营系统终端流向列表导出接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
from
common.handle_excel
import
HandleExcel
import
requests
import
random
import
json
import
os
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后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
,
"url60"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload60"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
flow_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取终端流向信息
demand_code
=
result
[
"data"
][
"list"
][
flow_random
][
"demandCode"
]
# 第三步进行导出操作
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url62"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload62"
,
demand_code
)
"""
场景: 导出功能验证_终端流向
用例名称:导出功能验证_终端流向
输出:{"demandCode":"%s"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取文件
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))))
file_path
=
BASE_DIR
+
"/data/cmdc_files/终端流向管理列表.xlsx"
# 获取到导出文件存入cmdc_files文件中
with
open
(
file_path
,
'wb'
)
as
f
:
f
.
write
(
result
.
content
)
# 获取导出文件中订单编号
excel
=
HandleExcel
(
file_path
,
"Sheet1"
)
# print(excel.read_data())
result
=
{
"demandCode"
:
excel
.
read_data
()[
0
].
get
(
"订单编号"
)}
# 将接口响应时间添加至结果中
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict62"
,
demand_code
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/库存重新获取刷新接口验证.air/库存重新获取刷新接口验证.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc库存重新获取刷新接口验证,2295,2295-106,sit,bs
主数据平台:后台运营系统库存重新获取刷新接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
random
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username2"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password2"
)
# 获取登录后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
,
"url118"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload118"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
debt_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"queryDemandPageInfo"
][
"list"
])
-
1
)
# 获取欠货信息
customerCode
=
result
[
"data"
][
"queryDemandPageInfo"
][
"list"
][
debt_random
][
"customerCode"
]
demandId
=
result
[
"data"
][
"queryDemandPageInfo"
][
"list"
][
debt_random
][
"demandId"
]
demandSubId
=
result
[
"data"
][
"queryDemandPageInfo"
][
"list"
][
debt_random
][
"demandSubId"
]
# 第三步获取欠货详情
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url120"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload120"
,
demandSubId
,
demandSubId
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 获取欠货详情商品信息
sellerCompanyCode
=
result
[
"data"
][
"list"
][
0
][
"sellerCompanyCode"
]
productCode
=
result
[
"data"
][
"list"
][
0
][
"productCode"
]
# 第四步进行库存重新刷新获取
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url106"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload106"
,
productCode
,
sellerCompanyCode
)
"""
场景: 库存重新获取刷新接口验证
用例名称:库存重新获取刷新接口验证
输出:{"status":1,"errorLog":null}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取库存更新结果
result
=
json
.
loads
(
result
.
content
)
result
=
{
"status"
:
result
[
"data"
][
"status"
],
"errorLog"
:
result
[
"data"
][
"errorLog"
]}
# 将接口响应时间添加至结果中
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict106"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/必传字段为空_获取用户默认地址_代客下单.air/必传字段为空_获取用户默认地址_代客下单.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc必传字段为空_获取用户默认地址_代客下单,2295,2295-36,sit,bs
主数据平台:后台运营系统获取用户默认地址信息接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取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
)
# 第二步获取用户默认地址信息
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url36"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload36"
)
"""
场景: 必传字段为空_获取用户默认地址_代客下单
用例名称:必传字段为空_获取用户默认地址_代客下单
输出:{"success":false,"code":"NOUSERID","message":"USERID为空","data":null,"freshToken":null}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
result
=
json
.
loads
(
result
.
content
)
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict36"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/必传字段校验_jde配货单合并详情.air/必传字段校验_jde配货单合并详情.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc必传字段校验_jde配货单合并详情,2295,2295-25,sit,bs
主数据平台:后台运营系统获取jde配货单合并详情接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取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
)
# 第二步获取jde配货单合并详情
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url25"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload25"
)
"""
场景: 必传字段校验_jde配货单合并详情
用例名称:必传字段校验_jde配货单合并详情
输出:{"success":false,"code":"ERROR","message":"配货单不存在","data":null,"freshToken":null}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
result
=
json
.
loads
(
result
.
content
)
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict25"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/必传字段校验_获取jde配货单信息.air/必传字段校验_获取jde配货单信息.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc必传字段校验_获取jde配货单信息,2295,2295-24,sit,bs
主数据平台:后台运营系统获取jde配货单信息接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取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
)
# 第二步获取jde配货单信息
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url22"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload22"
)
"""
场景: 必传字段校验_获取jde配货单信息
用例名称:必传字段校验_获取jde配货单信息
输出:{"success":true,"code":"200","message":"OK","data":{"status":0,"countSuccess":0,"countFail":1,"message":"第1行,商品编码或物料编码为空!
\n
","data":[],"maps":null},"freshToken":null}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
result
=
json
.
loads
(
result
.
content
)
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict22"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/必传字段校验_通过Excel复制添加商品.air/必传字段校验_通过Excel复制添加商品.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc必传字段校验_通过Excel复制添加商品,2295,2295-17,sit,bs
主数据平台:后台运营系统通过Excel复制添加商品接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取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
)
# 第二步查看采购单详情信息
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url17"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload17"
)
"""
场景: 必传字段校验_通过Excel复制添加商品
用例名称:必传字段校验_通过Excel复制添加商品
输出:{"success":true,"code":"200","message":"OK","data":{"status":0,"countSuccess":0,"countFail":1,"message":"第1行,商品编码或物料编码为空!
\n
","data":[],"maps":null},"freshToken":null}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
result
=
json
.
loads
(
result
.
content
)
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict17"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/必填字段校验_jde配货推送.air/必填字段校验_jde配货推送.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc必填字段校验_jde配货推送,2295,2295-30,sit,bs
主数据平台:后台运营系统获取jde配货推送接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取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
)
# 第二步jde配货单推送
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url30"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload30"
)
"""
场景: 必填字段校验_jde配货推送
用例名称:必填字段校验_jde配货推送
输出:{"success":false,"code":"ERROR","message":"配货单不存在","data":null,"freshToken":null}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
result
=
json
.
loads
(
result
.
content
)
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict30"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/必填字段校验_勾选合并_jde配货管理.air/必填字段校验_勾选合并_jde配货管理.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc必填字段校验_勾选合并_jde配货管理,2295,2295-18,sit,bs
主数据平台:后台运营系统合并接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取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
)
# 第二步勾选合并
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url18"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload18"
)
"""
场景: 必填字段校验_勾选合并_jde配货管理
用例名称:必填字段校验_勾选合并_jde配货管理
输出:{"success":false,"code":"ERROR","message":"至少两个才能合并","data":null,"freshToken":null}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
result
=
json
.
loads
(
result
.
content
)
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict18"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_order_list/必填字段校验_查看采购单详情.air/必填字段校验_查看采购单详情.py
0 → 100644
View file @
5271a37a
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc必填字段校验_查看采购单详情,2295,2295-13,sit,bs
主数据平台:后台运营系统查询采购单详情信息接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
random
import
datetime
import
requests
import
json
module
=
"cmdc_order_list"
# 第一步登录后台运营系统获取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
)
# 第二步查看采购单详情信息
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url13"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload13"
)
"""
场景: 必填字段校验_查看采购单详情
用例名称:必填字段校验_查看采购单详情
输出:{"success":false,"code":"500","message":"采购单id不能为空","data":null,"freshToken":null}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
result
=
json
.
loads
(
result
.
content
)
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict13"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
Prev
1
…
22
23
24
25
26
27
28
29
30
…
48
Next
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