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
632aee92
Commit
632aee92
authored
Jan 29, 2024
by
liguangyu06
Browse files
代码优化
parent
af6e3ee1
Changes
8
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_31st/a_站点资料申请变更功能验证.air/a_站点资料申请变更功能验证.py
View file @
632aee92
...
...
@@ -2,7 +2,7 @@
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc站点资料申请变更功能验证,31,31-5,sit,b
e
case_tag:cmdc_api,cmdc站点资料申请变更功能验证,31,31-5,sit,b
s
主数据平台:后台运营系统站点资料申请变更接口
"""
...
...
@@ -15,8 +15,8 @@ import json
module
=
"cmdc_31st"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username1
_be
"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password1
_be
"
)
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
)
...
...
air_case/cmdc_31st/查询条件验证_变更审核列表.air/查询条件验证_变更审核列表.py
View file @
632aee92
...
...
@@ -2,7 +2,7 @@
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc查询条件验证_变更审核列表,31,31-7,sit,b
e
case_tag:cmdc_api,cmdc查询条件验证_变更审核列表,31,31-7,sit,b
s
主数据平台:后台运营系统站点资料变更审核列表接口
"""
...
...
@@ -16,8 +16,8 @@ import json
module
=
"cmdc_31st"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username
1_be1
"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password
1_be1
"
)
username
=
commonFuc
().
get_business_data
(
module
,
"username
2
"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password
2
"
)
# 获取登录后Cmdc_access_token
cmdc_access_token
=
CmdcDoLogin
(
username
,
password
).
get_token
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers"
,
cmdc_access_token
)
...
...
air_case/cmdc_31st/查询条件验证_站点管理.air/查询条件验证_站点管理.py
View file @
632aee92
...
...
@@ -2,7 +2,7 @@
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc查询条件验证_站点管理,31,31-11,sit,b
e
case_tag:cmdc_api,cmdc查询条件验证_站点管理,31,31-11,sit,b
s
主数据平台:后台运营系统站点列表接口
"""
...
...
@@ -15,8 +15,8 @@ import json
module
=
"cmdc_31st"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username
1_be1
"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password
1_be1
"
)
username
=
commonFuc
().
get_business_data
(
module
,
"username
2
"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password
2
"
)
# 获取登录后Cmdc_access_token
cmdc_access_token
=
CmdcDoLogin
(
username
,
password
).
get_token
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers"
,
cmdc_access_token
)
...
...
@@ -27,7 +27,7 @@ request_body = commonFuc().get_business_data(module, "payload7")
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# print(result)
# 生成随机数
website_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取站点信息
...
...
air_case/cmdc_31st/查询条件验证_站点资料变更列表.air/查询条件验证_站点资料变更列表.py
View file @
632aee92
...
...
@@ -2,7 +2,7 @@
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc查询条件验证_站点资料变更列表,31,31-2,sit,b
e
case_tag:cmdc_api,cmdc查询条件验证_站点资料变更列表,31,31-2,sit,b
s
主数据平台:后台运营系统获取站点资料变更列表接口
"""
...
...
@@ -17,8 +17,8 @@ import json
module
=
"cmdc_31st"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username1
_be
"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password1
_be
"
)
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
)
...
...
@@ -55,6 +55,7 @@ api_time = float(result.elapsed.total_seconds())
# 获取查询结果中applyNo
result
=
json
.
loads
(
result
.
content
)
# print(result)
result
=
{
"applyNo"
:
result
[
"data"
][
"list"
][
0
][
"applyNo"
]}
# 将接口响应时间添加至result
...
...
air_case/cmdc_31st/站点资料变更列表获取.air/站点资料变更列表获取.py
View file @
632aee92
...
...
@@ -2,7 +2,7 @@
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc站点资料变更列表获取,31,31-1,sit,b
e
case_tag:cmdc_api,cmdc站点资料变更列表获取,31,31-1,sit,b
s
主数据平台:后台运营系统获取站点资料变更列表接口
"""
...
...
@@ -15,8 +15,8 @@ import json
module
=
"cmdc_31st"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username1
_be
"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password1
_be
"
)
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
)
...
...
@@ -39,6 +39,7 @@ api_time = float(result.elapsed.total_seconds())
# 获取站点变更记录数量
result
=
json
.
loads
(
result
.
content
)
print
(
result
)
result
=
{
"total"
:
result
[
"data"
][
"total"
]}
# 将接口响应时间添加至result
...
...
@@ -47,14 +48,14 @@ result["api_time"] = api_time
# 数据库操作
mysql_handle
=
mySql
()
# 获取conf.ini文件中配置的数据库信息
host
,
port
,
user
,
pwd
=
mysql_handle
.
getConf
(
db
=
"cmdc_db
_be
"
)
host
,
port
,
user
,
pwd
=
mysql_handle
.
getConf
(
db
=
"cmdc_db"
)
# 查询数据库中站点对应的站点资料变更记录数量
sql
=
"SELECT count(t.tripartiteId) FROM `cmdc-user`.cmdc_tripartite_change t WHERE companyCode = 001
02
"
sql
=
"SELECT count(t.tripartiteId) FROM `cmdc-user`.cmdc_tripartite_change t WHERE companyCode = 001
11
"
total
=
mysql_handle
.
selectSql
(
host
,
port
,
user
,
pwd
,
"cmdc-user"
,
sql
)[
0
][
0
]
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict1"
,
total
)
#
print(check_dict)
print
(
check_dict
)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_31st/站点资料变更审核列表获取.air/站点资料变更审核列表获取.py
View file @
632aee92
...
...
@@ -2,7 +2,7 @@
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc站点资料变更审核列表获取,31,31-6,sit,b
e
case_tag:cmdc_api,cmdc站点资料变更审核列表获取,31,31-6,sit,b
s
主数据平台:后台运营系统站点资料变更审核列表接口
"""
...
...
@@ -15,8 +15,8 @@ import json
module
=
"cmdc_31st"
# 第一步登录后台运营系统获取token
username
=
commonFuc
().
get_business_data
(
module
,
"username
1_be1
"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password
1_be1
"
)
username
=
commonFuc
().
get_business_data
(
module
,
"username
2
"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password
2
"
)
# 获取登录后Cmdc_access_token
cmdc_access_token
=
CmdcDoLogin
(
username
,
password
).
get_token
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers"
,
cmdc_access_token
)
...
...
air_case/cmdc_31st/获取用户已合作站点信息.air/获取用户已合作站点信息.py
View file @
632aee92
...
...
@@ -2,7 +2,7 @@
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc获取用户已合作站点信息,31,31-15,sit,b
e
case_tag:cmdc_api,cmdc获取用户已合作站点信息,31,31-15,sit,b
s
主数据平台:多采商城获取用户已合作站点信息接口
"""
...
...
@@ -15,8 +15,8 @@ import json
module
=
"cmdc_31st"
# 第一步获取登录多采商城所需账号密码
username
=
commonFuc
().
get_business_data
(
module
,
"username
_be
"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password
_be
"
)
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
)
...
...
@@ -50,7 +50,7 @@ mysql_handle = mySql()
host
,
port
,
user
,
pwd
=
mysql_handle
.
getConf
(
db
=
"cmdc_db_be"
)
# 查询数据库中对应采购计划修改记录数量
sql
=
"SELECT count(t.companyId) FROM `cmdc-user`.cmdc_company_user t WHERE userId =
7
"
sql
=
"SELECT count(t.companyId) FROM `cmdc-user`.cmdc_company_user t WHERE userId =
69
"
total
=
mysql_handle
.
selectSql
(
host
,
port
,
user
,
pwd
,
"cmdc-user"
,
sql
)[
0
][
0
]
# 获取预期结果
...
...
air_case/cmdc_31st/获取登录用户信息.air/获取登录用户信息.py
View file @
632aee92
...
...
@@ -2,7 +2,7 @@
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc获取登录用户信息,31,31-14,sit,b
e
case_tag:cmdc_api,cmdc获取登录用户信息,31,31-14,sit,b
s
主数据平台:多采商城获取登录用户信息接口
"""
...
...
@@ -14,8 +14,8 @@ import json
module
=
"cmdc_31st"
# 第一步获取登录多采商城所需账号密码
username
=
commonFuc
().
get_business_data
(
module
,
"username
_be
"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password
_be
"
)
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
)
...
...
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