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
8c52dc32
Commit
8c52dc32
authored
Aug 10, 2023
by
xiao-hesheng
Browse files
封装登录函数处理token procode
添加企业审核脚本
parent
471ca1d0
Changes
8
Hide whitespace changes
Inline
Side-by-side
air_case/mdm3-ea/企业注册提交接口_认领.air/企业注册提交接口_认领.py
deleted
100644 → 0
View file @
471ca1d0
# -*- encoding=utf8 -*-
__author__
=
"xiaohesheng"
"""
case_tag:api,mdm-web企业审核,用例集id2232,sit,on
主数据平台:注册企业接口
"""
from
common.common_func
import
commonFuc
import
time
module
=
"mdm3-ea"
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"VerifyCode_url"
)
#发送获取验证码请求
#发送请求
result
=
commonFuc
().
http_get
(
url
,
request_body
,
headers
)
print
(
result
)
\ No newline at end of file
air_case/mdm3-ea/注册企业锁定认领审核流程.air/注册企业锁定认领审核流程.py
0 → 100644
View file @
8c52dc32
# -*- encoding=utf8 -*-
__author__
=
"xiaohesheng"
"""
暂未调试脚本
case_tag:api,mdm-web企业审核,用例集id2234,sit,on,10086
主数据平台:注册企业审核认领流程
"""
from
common.common_func
import
commonFuc
from
air_case.mdm_login.登录外网系统.登录外网系统
import
login_system
module
=
"mdm3-ea"
# 注册企业
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"CompanyRegist_url"
)
# #获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
))
print
(
headers
)
name
=
commonFuc
().
get_business_data
(
module
,
"name1"
)
# 获取前缀name
cname
=
name
+
commonFuc
().
randomString
(
5
)
# 随机数生成拼接企业名称
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload2"
,
cname
,
cname
,
cname
,
cname
,
cname
,
cname
)
print
(
request_body
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
# 获取id
id1
=
commonFuc
().
analysis_json
(
'id'
,
result
)
# 企业注册提交接口_认领
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"updateById_url"
)
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
print
(
username
,
password
)
# 获取token
token
,
projectCode
=
login_system
(
username
,
password
).
get_token
()
#获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
projectCode
,
token
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload"
,
id1
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
# # print(result)
#获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict"
)
print
(
check_dict
)
#=============== 企业注册提交接口_认领结束
#企业注册提交接口_查询数据_开始
#企业注册提交接口_查询数据_结束
#断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
#断言实际结果中是否包含预期的文本
commonFuc
().
check_text_exist
(
name
,
result
)
air_case/mdm_login/登录外网系统.air/登录外网系统.py
View file @
8c52dc32
...
...
@@ -8,12 +8,16 @@ case_tag:mdm-web,10086登录,用例集id2226
from
common.common_func
import
commonFuc
from
common.tokenUtils
import
*
class
login_system
():
module
=
"mdm3_login"
def
__init__
(
self
,
username
,
password
):
self
.
username
=
username
self
.
password
=
password
module
=
"mdm3_login"
# 获取验证码接口
# 获取验证码接口
def
get_token
(
self
):
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
self
.
module
,
"VerifyCode_url"
)
print
(
"aaaaaaaaaaaaaaaaaa"
+
url
)
...
...
@@ -23,42 +27,48 @@ class login_system():
print
(
result
)
uuid
=
commonFuc
().
analysis_json
(
'uuId'
,
result
)
print
(
uuid
)
#如果不传参数就使用默认数据登录
#
如果不传参数就使用默认数据登录
# username = commonFuc().get_business_data(self.module, "username")
# password = commonFuc().get_business_data(self.module, "password")
# print(username,password)
username
=
self
.
username
password
=
self
.
password
EncryptPassword
=
TokenUtils
(
username
,
password
,
uuid
).
get_PasswordEncrypt
()
print
(
'加密后的密码'
,
EncryptPassword
)
#
加密后的密码
login_url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
self
.
module
,
"login_url"
)
request_body
=
commonFuc
().
get_business_data
(
self
.
module
,
"payload"
,
username
,
EncryptPassword
,
uuid
)
EncryptPassword
=
TokenUtils
(
username
,
password
,
uuid
).
get_PasswordEncrypt
()
print
(
'加密后的密码'
,
EncryptPassword
)
#
加密后的密码
login_url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
self
.
module
,
"login_url"
)
request_body
=
commonFuc
().
get_business_data
(
self
.
module
,
"payload"
,
username
,
EncryptPassword
,
uuid
)
print
(
request_body
)
# #获取请求头信息
headers
=
commonFuc
().
get_business_data
(
self
.
module
,
"json_headers"
,
commonFuc
().
get_business_data
(
self
.
module
,
"json_contentType"
))
headers
=
commonFuc
().
get_business_data
(
self
.
module
,
"json_headers"
,
commonFuc
().
get_business_data
(
self
.
module
,
"json_contentType"
))
print
(
headers
)
# 发送登录请求
result
=
commonFuc
().
http_post
(
login_url
,
request_body
,
headers
)
token
=
commonFuc
().
analysis_json
(
'token'
,
result
)
uxid
=
commonFuc
().
analysis_json
(
'uxid'
,
result
)
projectCode
=
commonFuc
().
analysis_json
(
'projectCode'
,
result
)
print
(
token
,
uxid
)
#平台登录,请求头里面有token
headers
=
commonFuc
().
get_business_data
(
self
.
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
self
.
module
,
"json_contentType"
),
token
,
projectCode
)
print
(
'平台登录请求头'
,
headers
)
platform_login_url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
self
.
module
,
"platform_login_url"
)
request_body
=
commonFuc
().
get_business_data
(
self
.
module
,
"payload2"
,
token
,
uxid
,
projectCode
)
token
=
commonFuc
().
analysis_json
(
'token'
,
result
)
uxid
=
commonFuc
().
analysis_json
(
'uxid'
,
result
)
projectCode
=
commonFuc
().
analysis_json
(
'projectCode'
,
result
)
print
(
token
,
uxid
)
# 平台登录,请求头里面有token
headers
=
commonFuc
().
get_business_data
(
self
.
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
self
.
module
,
"json_contentType"
),
token
,
projectCode
)
print
(
'平台登录请求头'
,
headers
)
platform_login_url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
self
.
module
,
"platform_login_url"
)
request_body
=
commonFuc
().
get_business_data
(
self
.
module
,
"payload2"
,
token
,
uxid
,
projectCode
)
print
(
request_body
)
# 发送平台登录请求
result
=
commonFuc
().
http_post
(
platform_login_url
,
request_body
,
headers
)
print
(
'平台登录接口结果'
,
result
)
print
(
'平台登录接口结果'
,
result
)
#获取预期结果
#
获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
self
.
module
,
"checkDict"
)
print
(
check_dict
)
#断言实际结果中是否不包含预期的文本
commonFuc
().
check_text_exist
(
uxid
,
result
)
return
token
login_system
(
'test001'
,
'a123456!'
).
get_token
()
# 断言实际结果中是否不包含预期的文本
commonFuc
().
check_text_exist
(
uxid
,
result
)
return
token
,
projectCode
# login_system('test001', 'a123456!').get_token()
# if __name__ == '__main__':
# print(login_system('test001','a123456!').get_token())
\ No newline at end of file
# print(login_system('test001','a123456!').get_token())
air_case/mdm_login/登录外网系统/登录外网系统.py
0 → 100644
View file @
8c52dc32
# -*- encoding=utf8 -*-
__author__
=
"xiaohesheng"
"""
case_tag:mdm-web,10086登录,用例集id2226
主数据平台:统一登录接口,第一步获取验证码,第二步登录系统,第三步平台登录验证token
"""
from
common.common_func
import
commonFuc
from
common.tokenUtils
import
*
class
login_system
():
module
=
"mdm3_login"
def
__init__
(
self
,
username
,
password
):
self
.
username
=
username
self
.
password
=
password
# 获取验证码接口
def
get_token
(
self
):
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
self
.
module
,
"VerifyCode_url"
)
print
(
"aaaaaaaaaaaaaaaaaa"
+
url
)
# 发送请求
result
=
commonFuc
().
http_get
(
url
,
headers
=
""
,
params
=
""
)
print
(
result
)
uuid
=
commonFuc
().
analysis_json
(
'uuId'
,
result
)
print
(
uuid
)
# 如果不传参数就使用默认数据登录
# username = commonFuc().get_business_data(self.module, "username")
# password = commonFuc().get_business_data(self.module, "password")
# print(username,password)
username
=
self
.
username
password
=
self
.
password
EncryptPassword
=
TokenUtils
(
username
,
password
,
uuid
).
get_PasswordEncrypt
()
print
(
'加密后的密码'
,
EncryptPassword
)
# 加密后的密码
login_url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
self
.
module
,
"login_url"
)
request_body
=
commonFuc
().
get_business_data
(
self
.
module
,
"payload"
,
username
,
EncryptPassword
,
uuid
)
print
(
request_body
)
# #获取请求头信息
headers
=
commonFuc
().
get_business_data
(
self
.
module
,
"json_headers"
,
commonFuc
().
get_business_data
(
self
.
module
,
"json_contentType"
))
print
(
headers
)
# 发送登录请求
result
=
commonFuc
().
http_post
(
login_url
,
request_body
,
headers
)
token
=
commonFuc
().
analysis_json
(
'token'
,
result
)
uxid
=
commonFuc
().
analysis_json
(
'uxid'
,
result
)
projectCode
=
commonFuc
().
analysis_json
(
'projectCode'
,
result
)
print
(
token
,
uxid
)
# 平台登录,请求头里面有token
headers
=
commonFuc
().
get_business_data
(
self
.
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
self
.
module
,
"json_contentType"
),
token
,
projectCode
)
print
(
'平台登录请求头'
,
headers
)
platform_login_url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
self
.
module
,
"platform_login_url"
)
request_body
=
commonFuc
().
get_business_data
(
self
.
module
,
"payload2"
,
token
,
uxid
,
projectCode
)
print
(
request_body
)
# 发送平台登录请求
result
=
commonFuc
().
http_post
(
platform_login_url
,
request_body
,
headers
)
print
(
'平台登录接口结果'
,
result
)
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
self
.
module
,
"checkDict"
)
print
(
check_dict
)
# 断言实际结果中是否不包含预期的文本
commonFuc
().
check_text_exist
(
uxid
,
result
)
return
token
,
projectCode
# login_system('test001', 'a123456!').get_token()
# if __name__ == '__main__':
# print(login_system('test001','a123456!').get_token())
data/hosts
View file @
8c52dc32
...
...
@@ -19,7 +19,6 @@
122.9.41.244 gerrit.babytree-inc.com
10.54.17.153 localproxy.baobaoshu.com
192.168.24.43 gerrit.mtmm.com
10.17.65.22 case.cmic.com.cn
10.54.50.90 sso.baobaoshu.com
8.131.247.52 docp.plt.babytree-inc.com
...
...
data/mdm3-ea/data
View file @
8c52dc32
# 登录外网(主数据平台)系统
"VerifyCode_url": "/test2api/oauthService/auth/getVerifyCode"
login_data: {"orderCode": "10200512100243412"}
login_contentType: "application/json"
login_checkDict: {"rtn_code": "0000001"}
"CompanyRegist_url": "/test2api/mdmService/companyRegistBill/insertCompanyRegist"
"username": "1679886114521"
"password": "a123456!"
# 企业注册提交接口_认领
"updateById_url": "/test2api/mdmService/companyRegistBill/updateById"
json_contentType: "application/json"
json_headers: {
"Content-Type": "%s"
}
# 认领
json_headers2: {
"Content-Type": "%s",
"token": "%s",
"X-APP-CODE":"%s",
"X-SESSION-ID":"%s"
}
"payload": {
"id": "%s",
"isLocked": 1
}
#企业注册接口-器械注册人-正常注册-所有输入项填写
"payload2": {
"compFunction": "2,3,4",
"compFunctionArr": [
"2",
"3",
"4"
],
"cname": "%s",
"shortName": "%s",
"isAbroad": "0",
"addrCodeList": [
"11",
"1101",
"110101"
],
"area": "北京市市辖区东城区",
"code": "110101",
"userName": "%s",
"address": "007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007007",
"userLoginCode": "%s",
"userLoginPsw": "a123456!",
"confimPassword": "a123456!",
"registContactUser": "张三李四",
"registContactWay": "13800138000",
"email": "xhs007@sina.com",
"registSourceProject": "%s",
"legal": "张三李四",
"erpCode": "%s",
"dataEntrance": "注册",
"compKind": "1",
"upCompanyId": "p00cesc",
"companyRegistBizscopeVos": [
{
"bizScopeCode": "01",
"bizScopeCodeName": "有源手术器械",
"bizScopeType": 2
},
{
"bizScopeCode": "6801",
"bizScopeCodeName": "基础外科手术器械",
"bizScopeType": 1
}
],
"certVOList": [
{
"id": 1,
"billId": "",
"certKind": "YLQXJYXKZ",
"certKindName": "医疗器械经营许可证",
"certCode": "007",
"expdtBeginDate": "2023-04-01 16:03:04",
"expdtEndDate": "2044-05-03 16:03:06",
"isValidingCheck": false,
"isValiding": 0,
"companyRegistCertFile": [
{
"filePath": "/sfile/2023/pub/src=http___10wallpaper.com_wallp_36a6c16d51c34bd5a3c9d41f356bcfc3.jpg",
"fileOriginalName": "src=http___10wallpaper.com_wallpaper_2560x1600_1607_Mountains_macos_sierra_sky-Landscape_Theme_Wallpaper_2560x1600.jpg&refer=http___10wallpaper.jpg"
}
],
"printFile": "",
"certListCode": []
},
{
"id": 2,
"billId": "",
"certKind": "YYZZ",
"certKindName": "营业执照",
"certCode": "007",
"expdtBeginDate": "2023-04-01 16:03:04",
"expdtEndDate": "2055-06-01 16:03:06",
"isValidingCheck": false,
"isValiding": 0,
"companyRegistCertFile": [
{
"filePath": "/sfile/2023/pub/src=http___10wallpaper.com_wallp_798c90875cae4ca0aa60f2ad1c225583.jpg",
"fileOriginalName": "src=http___10wallpaper.com_wallpaper_2560x1600_1607_Mountains_macos_sierra_sky-Landscape_Theme_Wallpaper_2560x1600.jpg&refer=http___10wallpaper.jpg"
}
],
"printFile": "",
"certListCode": []
},
{
"id": 3,
"billId": "",
"certKind": "YLQXJYBAPZ",
"certKindName": "医疗器械经营备案凭证",
"certCode": "007",
"expdtBeginDate": "2023-04-01 16:03:04",
"expdtEndDate": "2055-07-06 16:03:06",
"isValidingCheck": false,
"isValiding": 0,
"companyRegistCertFile": [
{
"filePath": "/sfile/2023/pub/src=http___10wallpaper.com_wallp_f176acb649604765a720370b0dc9f4ea.jpg",
"fileOriginalName": "src=http___10wallpaper.com_wallpaper_2560x1600_1607_Mountains_macos_sierra_sky-Landscape_Theme_Wallpaper_2560x1600.jpg&refer=http___10wallpaper.jpg"
}
],
"printFile": "",
"certListCode": []
},
{
"id": 4,
"billId": "",
"certKind": "YLQXSCQYXKZ",
"certKindName": "医疗器械生产企业许可证",
"certCode": "007",
"expdtBeginDate": "2023-04-01 16:03:04",
"expdtEndDate": "2056-07-01 16:03:06",
"isValidingCheck": false,
"isValiding": 0,
"companyRegistCertFile": [
{
"filePath": "/sfile/2023/pub/src=http___10wallpaper.com_wallp_b729469d97d0465dbcab54dd33fcc457.jpg",
"fileOriginalName": "src=http___10wallpaper.com_wallpaper_2560x1600_1607_Mountains_macos_sierra_sky-Landscape_Theme_Wallpaper_2560x1600.jpg&refer=http___10wallpaper.jpg"
}
],
"printFile": "",
"certListCode": []
}
]
}
"login_enc_user_id": "国药集团湖北分公司mQDwR7"
"login_url": "/test2api/oauthService/auth/getVerifyCode"
...
...
@@ -42,7 +181,7 @@ json_headers: {
"certVOList": []
}
"name1": "国药集团公司"
checkDict: {"code": 0,'msg': None}
checkDict: {"code": 0,'msg': None
,'data':1
}
"payload": {
"compFunction": "2",
...
...
report/summary.html
View file @
8c52dc32
...
...
@@ -55,9 +55,9 @@
<tr
width=
"600"
>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
0
</td>
<td
class=
'details-col-elapsed'
>
0分0秒
</td>
<td
class=
"details-col-elapsed"
>
10
0.0%
</td>
<td
class=
"details-col-elapsed"
>
0.0%
</td>
</tr>
</table>
...
...
@@ -72,9 +72,9 @@
</tr>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/
登录外网系统
/log.html'
target=
'_blank'
>
登录外网系统
</a></td>
<td
class=
"
success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
0.
533
</td>
<td
class=
"details-col-elapsed"
><a
href=
'../log/
注册企业锁定认领审核流程
/log.html'
target=
'_blank'
>
注册企业锁定认领审核流程
</a></td>
<td
class=
"
fail"
>
失败
</td>
<td
class=
"details-col-elapsed"
>
0.
384
</td>
<td
class=
"details-col-elapsed"
>
xiaohesheng
</td>
</tr>
...
...
runner.py
View file @
8c52dc32
...
...
@@ -81,6 +81,7 @@ if __name__ == '__main__':
file_path
=
os
.
path
.
join
(
path
,
file
)
if
os
.
path
.
isfile
(
file_path
):
os
.
remove
(
file_path
)
print
(
'删了什么文件'
,
file_path
)
else
:
if
str
(
file
).
startswith
(
"场景"
):
name
=
str
(
file
).
replace
(
".air"
,
""
)
...
...
@@ -88,3 +89,5 @@ if __name__ == '__main__':
if
os
.
path
.
exists
(
del_file
):
os
.
remove
(
del_file
)
shutil
.
rmtree
(
file_path
)
print
(
'删了什么文件'
,
del_file
)
print
(
'结束了'
)
\ 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