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
01da3089
Commit
01da3089
authored
1 year ago
by
liguangyu06
Browse files
Options
Download
Email Patches
Plain Diff
新增按条件启用逆向用例
parent
12e1911c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
air_case/cmdc_special_fresenius_group/按条件启用_启用已停用的套包_套包商品管理.air/按条件启用_启用已停用的套包_套包商品管理.py
+73
-0
..._group/按条件启用_启用已停用的套包_套包商品管理.air/按条件启用_启用已停用的套包_套包商品管理.py
air_case/cmdc_special_fresenius_group/按条件启用_启用已启用的套包_套包商品管理.air/按条件启用_启用已启用的套包_套包商品管理.py
+73
-0
..._group/按条件启用_启用已启用的套包_套包商品管理.air/按条件启用_启用已启用的套包_套包商品管理.py
data/cmdc_special_fresenius_group/data
+6
-2
data/cmdc_special_fresenius_group/data
with
152 additions
and
2 deletions
+152
-2
air_case/cmdc_special_fresenius_group/按条件启用_启用已停用的套包_套包商品管理.air/按条件启用_启用已停用的套包_套包商品管理.py
0 → 100644
+
73
-
0
View file @
01da3089
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc验证按条件启用已停用的套包,2264,2264-45,sit,bs
主数据平台:运营后台管理系统Excel导入接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
from
common.handle_excel
import
HandleExcel
import
requests
import
json
import
os
module
=
"cmdc_special_fresenius_group"
# 第一步登录后台运营平台获取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_headers2"
,
cmdc_access_token
)
# 获取文件
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"
# 套包状态-停用状态
group_status
=
2
# 获取套包列表
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"group_list"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"group_payload"
,
group_status
)
result
=
requests
.
post
(
url
,
headers
=
headers
,
json
=
request_body
)
result
=
json
.
loads
(
result
.
content
)
# 获取套包信息groupCode、groupName
group_code
=
result
[
"data"
][
"list"
][
0
][
"groupCode"
]
group_name
=
result
[
"data"
][
"list"
][
0
][
"groupName"
]
# 将套包信息写入文件中
excel
=
HandleExcel
(
file_path
,
"Sheet1"
)
excel
.
write_data
(
row
=
2
,
column
=
1
,
value
=
group_code
)
excel
.
write_data
(
row
=
2
,
column
=
2
,
value
=
group_name
)
# 第二步进行套包数据导入操作
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url10"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload10"
)
# 获取文件
file
=
open
(
file_path
,
"rb"
)
files
=
{
"file"
:
file
}
"""
场景:验证使用按条件启用功能,是否可以启用已经是停用状态下的套包
用例名称:验证按条件启用已停用的套包
输出:{"errList":["%s"]}
"""
# 发送请求
result
=
requests
.
post
(
url
,
files
=
files
,
headers
=
headers
,
data
=
request_body
)
result
=
json
.
loads
(
result
.
content
)
file
.
close
()
# 截取结果中errList信息
result
=
{
"errList"
:
result
[
"data"
][
"errMsg"
][
"errList"
]}
# 获取预期结果
err_list
=
"平台套包编号【{}】 在待启用记录里不存在!"
.
format
(
group_code
)
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict12"
,
err_list
)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
This diff is collapsed.
Click to expand it.
air_case/cmdc_special_fresenius_group/按条件启用_启用已启用的套包_套包商品管理.air/按条件启用_启用已启用的套包_套包商品管理.py
0 → 100644
+
73
-
0
View file @
01da3089
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc验证按条件启用已启用的套包,2264,2264-44,sit,bs
主数据平台:运营后台管理系统Excel导入接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
from
common.handle_excel
import
HandleExcel
import
requests
import
json
import
os
module
=
"cmdc_special_fresenius_group"
# 第一步登录后台运营平台获取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_headers2"
,
cmdc_access_token
)
# 获取文件
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"
# 套包状态-启用状态
group_status
=
1
# 获取套包列表
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"group_list"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"group_payload"
,
group_status
)
result
=
requests
.
post
(
url
,
headers
=
headers
,
json
=
request_body
)
result
=
json
.
loads
(
result
.
content
)
# 获取套包信息groupCode、groupName
group_code
=
result
[
"data"
][
"list"
][
0
][
"groupCode"
]
group_name
=
result
[
"data"
][
"list"
][
0
][
"groupName"
]
# 将套包信息写入文件中
excel
=
HandleExcel
(
file_path
,
"Sheet1"
)
excel
.
write_data
(
row
=
2
,
column
=
1
,
value
=
group_code
)
excel
.
write_data
(
row
=
2
,
column
=
2
,
value
=
group_name
)
# 第二步进行套包数据导入操作
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url10"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload10"
)
# 获取文件
file
=
open
(
file_path
,
"rb"
)
files
=
{
"file"
:
file
}
"""
场景:验证使用按条件启用功能,是否可以启用已经是启用状态下的套包
用例名称:验证按条件启用已启用的套包
输出:{"errList":["%s"]}
"""
# 发送请求
result
=
requests
.
post
(
url
,
files
=
files
,
headers
=
headers
,
data
=
request_body
)
result
=
json
.
loads
(
result
.
content
)
file
.
close
()
# 截取结果中errList信息
result
=
{
"errList"
:
result
[
"data"
][
"errMsg"
][
"errList"
]}
# 获取预期结果
err_list
=
"平台套包编号【{}】 在待启用记录里不存在!"
.
format
(
group_code
)
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict11"
,
err_list
)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
This diff is collapsed.
Click to expand it.
data/cmdc_special_fresenius_group/data
+
6
-
2
View file @
01da3089
...
...
@@ -92,10 +92,14 @@ checkDict9: {"groupCode":"%s"}
"payload10": {"type":0}
#测试场景十一:验证使用按条件启用功能,是否可以启用已经是启用状态下的套包
#预期结果
checkDict11: {"errList":["%s"]}
#测试场景十二:验证使用按条件启用功能,是否可以启用已经是停用状态下的套包
#预期结果
checkDict12: {"errList":["%s"]}
...
...
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