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-spd
Commits
b79f1d55
Commit
b79f1d55
authored
Apr 17, 2024
by
xiao-hesheng
Browse files
优化脚本
parent
af3af848
Changes
4
Hide whitespace changes
Inline
Side-by-side
air_case/b5_spd3_core_business_flow/a_a1_流程一外网企业注册审批.air/a_a1_流程一外网企业注册审批.py
View file @
b79f1d55
...
@@ -7,7 +7,7 @@ from common.timeUtils import timeUtils
...
@@ -7,7 +7,7 @@ from common.timeUtils import timeUtils
__author__
=
"xiaohesheng"
__author__
=
"xiaohesheng"
"""
"""
case_tag:api,mdm
1
,a_a1_流程一外网企业注册审批,
id9999,id9999
-1,sit,on
case_tag:api,mdm
_core
,a_a1_流程一外网企业注册审批,
2302,2302
-1,sit,on
内网:a_a1_流程一外网企业注册审批
内网:a_a1_流程一外网企业注册审批
"""
"""
...
...
air_case/b5_spd3_core_business_flow/a_a2_流程二供货关系申请提交审批.air/a_a2_流程二供货关系申请提交审批.py
View file @
b79f1d55
...
@@ -4,7 +4,7 @@ from common.fileUtls import FileUtils
...
@@ -4,7 +4,7 @@ from common.fileUtls import FileUtils
__author__
=
"xiaohesheng"
__author__
=
"xiaohesheng"
"""
"""
case_tag:api,mdm
-web1
,a_a2_流程二供货关系申请提交审批,
id9999,id9999
-2,sit,on
case_tag:api,mdm
_core
,a_a2_流程二供货关系申请提交审批,
2302,2302
-2,sit,on
主数据平台:a_a2_流程二供货关系申请提交审批
主数据平台:a_a2_流程二供货关系申请提交审批
"""
"""
...
...
air_case/b5_spd3_core_business_flow/a_a3_流程三_产品导入和审批.air/a_a3_流程三_产品导入和审批.py
View file @
b79f1d55
...
@@ -4,7 +4,7 @@ from common.fileUtls import FileUtils
...
@@ -4,7 +4,7 @@ from common.fileUtls import FileUtils
__author__
=
"xiaohesheng"
__author__
=
"xiaohesheng"
"""
"""
case_tag:api,mdm-
web1
,a_a3_流程三_产品导入和审批,
id9999,id9999
-3,sit,on
case_tag:api,mdm-
core
,a_a3_流程三_产品导入和审批,
2302,2302
-3,sit,on
主数据平台:a_a3_流程三_产品导入和审批
主数据平台:a_a3_流程三_产品导入和审批
"""
"""
...
...
air_case/b5_spd3_core_business_flow/a_a4_流程四_基础模块设置.air/a_a4_流程四_基础模块设置.py
0 → 100644
View file @
b79f1d55
# -*- encoding=utf8 -*-
from
common.fileUtls
import
FileUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,mdm-core,a_a4_流程四_基础模块设置,2302,2302-4,sit,on
主数据平台:a_a3_流程三_产品导入和审批
"""
from
common.common_func
import
commonFuc
from
air_case.mdm_login.登录外网系统.登录外网系统
import
login_system
from
airtest.core.api
import
using
import
sys
module
=
"b5_spd3_core_business_flow"
def
h_login
():
module
=
"a4_mdm3_cm"
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password1"
)
print
(
'医院名称'
,
username
)
print
(
username
,
password
,
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
)
# 获取token和projectCode
import
time
while
True
:
try
:
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
except
:
time
.
sleep
(
6
)
continue
else
:
return
token
,
projectCode
,
uxid
,
corpId
,
username
def
e_login
(
type
=
1
):
module
=
"a4_mdm3_cm"
username
=
'username'
if
type
==
1
:
#注册一个新企业,并审批
pro_path
=
commonFuc
().
get_pro_path
()
sys
.
path
.
append
(
pro_path
+
r
'\\air_case\\a2_mdm3_ea\\企业审核.air'
)
using
(
pro_path
+
r
'\\air_case\\a2_mdm3_ea\\企业审核.air'
)
from
企业审核
import
test1
info
=
FileUtils
().
r_info
(
"a2_mdm3_ea"
,
"企业信息"
)
print
(
info
)
username
=
info
[
'cname'
]
print
(
'aaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
username
)
else
:
#读取文件中存入的企业信息
info
=
FileUtils
().
r_info
(
"a2_mdm3_ea"
,
"企业信息"
)
print
(
info
)
username
=
info
[
'cname'
]
print
(
'aaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
username
)
#a2供货关系申请_客户类型_医院_登录_企业登录
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
print
(
username
,
password
)
# 获取token和projectCode
import
time
while
True
:
try
:
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
except
:
time
.
sleep
(
6
)
continue
else
:
return
token
,
projectCode
,
uxid
,
corpId
,
username
# break
def
add_goods
():
token
,
projectCode
,
uxid
,
corpId
,
e_name
=
e_login
(
2
)
# 获取医院corpId
h_token
,
h_projectCode
,
h_uxid
,
h_corpId
,
h_name
=
h_login
()
module
=
"a5_mdm3_pdm"
#b18供货目录申请_客户类型_医院_提交供货申请单_添加产品
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"addGoodsHandleInfos_url"
)
print
(
'url'
,
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
projectCode
)
goodsname
=
commonFuc
().
randomString
(
5
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload_1"
,
h_corpId
,
h_name
,
corpId
,
e_name
,
goodsname
,
e_name
)
# request_body = commonFuc().get_business_data(module, "payload10_1")
# print('request_body',request_body)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
#断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
if
code
==
0
:
commonFuc
().
check_text_exist
(
code
,
result
)
else
:
commonFuc
().
check_text_exist
(
-
1
,
result
)
def
apply
():
module
=
"a5_mdm3_pdm"
token
,
projectCode
,
uxid
,
corpId
,
username
=
e_login
(
2
)
#获取医院corpId
h_token
,
h_projectCode
,
h_uxid
,
h_corpId
,
h_name
=
h_login
()
# 登录
username
=
h_name
password
=
commonFuc
().
get_business_data
(
module
,
"password1"
)
print
(
username
,
password
)
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# 审批产品驳回
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"singleAudit_url"
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
projectCode
)
info
=
FileUtils
().
r_info6
(
module
,
"产品审核信息"
,
'message2'
)
print
(
info
)
MSPid
=
info
[
'MSPid'
]
hosId
=
info
[
'hosId'
]
hosGoodsId
=
info
[
'hosGoodsId'
]
provGoodsid
=
info
[
'provGoodsid'
]
goodsAuditBillId
=
info
[
'goodsAuditBillId'
]
targetId
=
info
[
'targetId'
]
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload3_1"
,
MSPid
,
hosId
,
hosGoodsId
,
provGoodsid
,
goodsAuditBillId
,
targetId
)
print
(
'产品信息审核查询请求体'
,
request_body
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
"产品信息审核查询返回结果"
,
result
)
checkDict
=
commonFuc
().
get_business_data
(
module
,
'checkDict'
)
commonFuc
().
check_result
(
checkDict
,
result
)
def
select1
():
module
=
"a5_mdm3_pdm"
token
,
projectCode
,
uxid
,
corpId
,
username
=
e_login
(
2
)
#获取医院corpId
h_token
,
h_projectCode
,
h_uxid
,
h_corpId
,
h_name
=
h_login
()
# 登录
username
=
h_name
password
=
commonFuc
().
get_business_data
(
module
,
"password1"
)
print
(
username
,
password
)
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# 产品信息审核查询
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"getAuditGoodsListByPage_url"
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
projectCode
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload2"
,
h_corpId
)
# print('产品信息审核查询请求体', request_body)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
"产品信息审核查询返回结果"
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
data
)
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
if
total
>=
1
:
id1
=
commonFuc
().
analysis_json
(
'id'
,
data1
[
0
])
auditOrgId
=
commonFuc
().
analysis_json
(
'hosId'
,
data1
[
0
])
hosGoodsId
=
commonFuc
().
analysis_json
(
'hosGoodsid'
,
data1
[
0
])
provGoodsid
=
commonFuc
().
analysis_json
(
'provGoodsid'
,
data1
[
0
])
goodsAuditBillId
=
commonFuc
().
analysis_json
(
'billId'
,
data1
[
0
])
targetId
=
commonFuc
().
analysis_json
(
'id'
,
data1
[
0
])
print
(
id1
,
auditOrgId
,
hosGoodsId
,
provGoodsid
,
goodsAuditBillId
,
targetId
)
info
=
(
id1
,
auditOrgId
,
hosGoodsId
,
provGoodsid
,
goodsAuditBillId
,
targetId
)
titlename
=
(
"MSPid"
,
'hosId'
,
'hosGoodsId'
,
'provGoodsid'
,
'goodsAuditBillId'
,
'targetId'
)
# 将产品审核信息写入到文件中
FileUtils
().
w_info6
(
info
,
module
,
'产品审核信息'
,
titlename
,
'message2'
)
else
:
commonFuc
().
check_text_exist
(
0
,
result
)
add_goods
()
select1
()
apply
()
\ No newline at end of file
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