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
dacddc0c
Commit
dacddc0c
authored
Aug 04, 2023
by
xiao-hesheng
Browse files
修改get_api_url实现方式,支持骨科,电商,spd3.0 spd2.0服务器地址设置
parent
38349afe
Changes
10
Hide whitespace changes
Inline
Side-by-side
air_case/mdm3-es/外网企业注册-器械注册人-所有输入项填写.air/外网企业注册-器械注册人-所有输入项填写.py
0 → 100644
View file @
dacddc0c
# -*- encoding=utf8 -*-
__author__
=
"xiaohesheng"
"""
case_tag:api,mdm-web2,用例集id2226,sit,on
主数据平台:注册企业接口_注册时_有附件
"""
from
common.common_func
import
commonFuc
module
=
"mdm3-es"
#企业注册接口
import
os
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"CompanyRegist_url"
)
print
(
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
)
"""
场景:外网主数据平台企业注册-器械注册人注册接口-正常注册-所有输入项填写
用例名称:企业注册接口-器械注册人-正常注册-所有输入项填写
输入:企业名称 变量名cname
输出:"rtn_msg": "返回注册企业信息"
"""
#发送请求
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/mdm3-es/外网企业注册-器械注册人-有附件.air/外网企业注册-器械注册人-有附件.py
0 → 100644
View file @
dacddc0c
# -*- encoding=utf8 -*-
__author__
=
"xiaohesheng"
"""
case_tag:api,mdm-web1,用例集id2226,sit,on
主数据平台:注册企业接口_注册时_有附件
"""
from
common.common_func
import
commonFuc
module
=
"mdm3-es"
#企业注册接口
import
os
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"CompanyRegist_url"
)
print
(
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
,
"payload1"
,
cname
,
cname
,
cname
,
cname
,
cname
)
print
(
request_body
)
"""
场景:外网主数据平台企业注册-器械注册人注册接口-正常注册-有附件
用例名称:企业注册接口-器械注册人-正常注册-有附件
输入:企业名称 变量名cname
输出:"rtn_msg": "返回注册企业信息"
"""
#发送请求
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/
spd3
/外网企业注册-器械注册人.air/外网企业注册-器械注册人.py
→
air_case/
mdm3-es
/外网企业注册-器械注册人.air/外网企业注册-器械注册人.py
View file @
dacddc0c
...
...
@@ -10,7 +10,7 @@ case_tag:api,mdm-web,用例集id2226,sit,on
from
common.common_func
import
commonFuc
import
time
module
=
"
spd3
"
module
=
"
mdm3-es
"
#企业注册接口
import
os
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"CompanyRegist_url"
)
...
...
air_case/
spd3
/登录外网系统.air/登录外网系统.py
→
air_case/
mdm3-es
/登录外网系统.air/登录外网系统.py
View file @
dacddc0c
...
...
@@ -10,7 +10,7 @@ case_tag:mdm-web,100086,用例集id2226
from
common.common_func
import
commonFuc
import
time
module
=
"
spd3
"
module
=
"
mdm3-es
"
#获取验证码接口
import
os
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"VerifyCode_url"
)
...
...
common/passwordUtils.py
View file @
dacddc0c
import
hashlib
from
Crypto.Cipher
import
AES
class
PasswordEncrypt
(
object
):
"""通过对密码进行加密,方便spd系统登录之后获取token
spd项目token不存于数据库中,token只存在于内存中
"""
def
__init__
(
self
,
username
,
userpwd
,
verifyCodeId
):
self
.
username
=
username
#用户名
self
.
userpwd
=
userpwd
#密码
self
.
verifyCodeId
=
verifyCodeId
#验证码id
def
__init__
(
self
,
username
,
userpwd
,
verifyCodeId
):
self
.
username
=
username
# 用户名
self
.
userpwd
=
userpwd
# 密码
self
.
verifyCodeId
=
verifyCodeId
# 验证码id
# 此函数实现密码加密
def
pwd_Encrypt
(
self
):
'''
{"username":"gyqxadmin",
"passwd":"af5d87060df01ce434e4a397b51a0b9bd960416aa873177889f6a0104b28e450acc980ab8d6391931a8470a91c37c94fad5d14f4925d860fb3314aca9bc4677a3ade29e23fb469b8710680995f8e218f",
"verifyCodeId":"512cdfebc1a042fa89d0f5a56d744f4d","verifyCode":"ece6","projectCode":"warehouse.pc"}
'''
# verifyCodeId = b'512cdfebc1a042fa89d0f5a56d744f4d'
verifyCodeId
=
bytes
(
self
.
verifyCodeId
)
verifyCodeId
=
self
.
verifyCodeId
verifyCode
=
bytes
(
verifyCodeId
[
0
:
16
])
print
(
"verifyCode:"
,
verifyCode
)
username_and_pwd
=
self
.
username
+
self
.
userpwd
#
print("verifyCode:", verifyCode)
username_and_pwd
=
self
.
username
+
self
.
userpwd
sha256EncodeStr
=
hashlib
.
sha256
(
username_and_pwd
.
encode
(
"utf-8"
))
print
(
"sha256EncodeStr:"
,
sha256EncodeStr
.
hexdigest
())
print
(
"encode sha256EncodeStr:"
,
sha256EncodeStr
.
hexdigest
().
encode
(
"utf-8"
))
#
print("sha256EncodeStr:", sha256EncodeStr.hexdigest())
#
print("encode sha256EncodeStr:", sha256EncodeStr.hexdigest().encode("utf-8"))
aes
=
AES
.
new
(
key
=
bytes
(
verifyCodeId
),
iv
=
verifyCode
,
mode
=
AES
.
MODE_CBC
)
en_text
=
aes
.
encrypt
(
self
.
pad
(
sha256EncodeStr
.
hexdigest
()).
encode
(
"utf-8"
))
# 加密明文
print
(
"en_text:"
,
en_text
)
print
(
"base64 de_text2:"
,
en_text
.
hex
())
#
print("en_text:", en_text)
#
print("base64 de_text2:", en_text.hex())
return
en_text
.
hex
()
def
pad
(
slef
,
text
):
def
pad
(
slef
,
text
):
print
(
type
(
text
))
text_length
=
len
(
text
)
amount_to_pad
=
AES
.
block_size
-
(
text_length
%
AES
.
block_size
)
print
(
'amount_to_pad'
,
amount_to_pad
)
print
(
type
(
amount_to_pad
))
if
amount_to_pad
==
0
:
amount_to_pad
=
AES
.
block_size
pad
=
chr
(
amount_to_pad
)
print
(
'pad'
,
pad
)
print
(
text
+
pad
*
amount_to_pad
)
return
text
+
pad
*
amount_to_pad
if
__name__
==
'__main__'
:
aa
=
PasswordEncrypt
(
'1679886114521'
,
'a123456!'
,
b
'9baf0389a84047fa8e8db78bd8c3530a'
)
aa
=
PasswordEncrypt
(
'1679886114521'
,
'a123456!'
,
b
'9baf0389a84047fa8e8db78bd8c3530a'
)
print
(
aa
.
pwd_Encrypt
())
data/mdm3-es/data
0 → 100644
View file @
dacddc0c
# 登录外网(主数据平台)系统
"VerifyCode_url": "/test2api/oauthService/auth/getVerifyCode"
login_data: {"orderCode": "10200512100243412"}
login_contentType: "application/json"
login_checkDict: {"rtn_code": "0000001"}
"login_enc_user_id": "国药集团湖北分公司mQDwR7"
"login_url": "/test2api/oauthService/auth/getVerifyCode"
#器械注册人接口
"CompanyRegist_url": "/test2api/mdmService/companyRegistBill/insertCompanyRegist"
json_contentType: "application/json"
json_headers: {
"Content-Type": "%s"
}
"payload": {
"compFunction": "2",
"compFunctionArr": ["2"],
"cname": "%s",
"shortName": "",
"isAbroad": "1",
"addrCodeList": [
"11"
],
"area": "",
"userName": "%s",
"address": "",
"userLoginCode": "%s",
"userLoginPsw": "a123456!",
"confimPassword": "a123456!",
"registContactUser": "",
"registContactWay": "",
"email": "%s@sina.com",
"registSourceProject": "%s",
"legal": "",
"erpCode": "002",
"dataEntrance": "注册",
"compKind": "0",
"upCompanyId": "",
"companyRegistBizscopeVos": [],
"certVOList": []
}
"name1": "国药集团公司"
checkDict: {"code": 0,'msg': None}
"payload": {
"compFunction": "2",
"compFunctionArr": ["2"],
"cname": "%s",
"shortName": "",
"isAbroad": "1",
"addrCodeList": [
"11"
],
"area": "",
"userName": "%s",
"address": "",
"userLoginCode": "%s",
"userLoginPsw": "a123456!",
"confimPassword": "a123456!",
"registContactUser": "",
"registContactWay": "",
"email": "%s@sina.com",
"registSourceProject": "%s",
"legal": "",
"erpCode": "002",
"dataEntrance": "注册",
"compKind": "0",
"upCompanyId": "",
"companyRegistBizscopeVos": [],
"certVOList": []
}
#企业注册-器械注册人-有附件
"payload1": {
"compFunction": "2",
"compFunctionArr": [
"2"
],
"cname": "%s",
"shortName": "",
"isAbroad": "0",
"addrCodeList": [
"11",
"1101",
"110101"
],
"area": "北京市市辖区东城区",
"code": "110101",
"userName": "%s",
"address": "",
"userLoginCode": "%s",
"userLoginPsw": "a123456!",
"confimPassword": "a123456!",
"registContactUser": "",
"registContactWay": "",
"email": "%s@sina.com",
"registSourceProject": "%s",
"legal": "",
"dataEntrance": "注册",
"compKind": "0",
"upCompanyId": "",
"companyRegistBizscopeVos": [],
"certVOList": [
{
"id": 1,
"billId": "",
"certKind": "YYZZ",
"certKindName": "营业执照",
"certCode": "006",
"expdtBeginDate": "2023-04-01 16:05:08",
"expdtEndDate": "2044-04-01 16:05:08",
"isValidingCheck": true,
"isValiding": 1,
"companyRegistCertFile": [
{
"filePath": "/sfile/2023/pub/src=http___10wallpaper.com_wallp_f7d03d60d2fe42da8be7d65dfe1de601.jpg",
"fileOriginalName": "src=http___10wallpaper.com_wallpaper_2560x1600_1607_Mountains_macos_sierra_sky-Landscape_Theme_Wallpaper_2560x1600.jpg&refer=http___10wallpaper.jpg"
}
],
"printFile": "",
"certListCode": []
}
]
}
#企业注册接口-器械注册人-正常注册-所有输入项填写
"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": []
}
]
}
\ No newline at end of file
data/
spd3
/message
→
data/
mdm3-es
/message
View file @
dacddc0c
File moved
data/
spd3
/sql
→
data/
mdm3-es
/sql
View file @
dacddc0c
File moved
data/spd3/data
deleted
100644 → 0
View file @
38349afe
# 登录外网(主数据平台)系统
"VerifyCode_url": "/test2api/oauthService/auth/getVerifyCode"
login_data: {"orderCode": "10200512100243412"}
login_contentType: "application/json"
login_checkDict: {"rtn_code": "0000001"}
"login_enc_user_id": "国药集团湖北分公司mQDwR7"
"login_url": "/test2api/oauthService/auth/getVerifyCode"
#器械注册人接口
"CompanyRegist_url": "/test2api/mdmService/companyRegistBill/insertCompanyRegist"
json_contentType: "application/json"
json_headers: {
"Content-Type": "%s"
}
"payload": {
"compFunction": "2",
"compFunctionArr": ["2"],
"cname": "%s",
"shortName": "",
"isAbroad": "1",
"addrCodeList": [
"11"
],
"area": "",
"userName": "%s",
"address": "",
"userLoginCode": "%s",
"userLoginPsw": "a123456!",
"confimPassword": "a123456!",
"registContactUser": "",
"registContactWay": "",
"email": "%s@sina.com",
"registSourceProject": "%s",
"legal": "",
"erpCode": "002",
"dataEntrance": "注册",
"compKind": "0",
"upCompanyId": "",
"companyRegistBizscopeVos": [],
"certVOList": []
}
"name1": "国药集团公司"
checkDict: {"code": 0,'msg': None}
report/summary.html
View file @
dacddc0c
...
...
@@ -54,8 +54,8 @@
</tr>
<tr
width=
"600"
>
<td
class=
'details-col-elapsed'
>
2
</td>
<td
class=
'details-col-elapsed'
>
2
</td>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
0分0秒
</td>
<td
class=
"details-col-elapsed"
>
100.0%
</td>
</tr>
...
...
@@ -72,16 +72,9 @@
</tr>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/外网企业注册-器械注册人/log.html'
target=
'_blank'
>
外网企业注册-器械注册人
</a></td>
<td
class=
"details-col-elapsed"
><a
href=
'../log/外网企业注册-器械注册人
-所有输入项填写
/log.html'
target=
'_blank'
>
外网企业注册-器械注册人
-所有输入项填写
</a></td>
<td
class=
"success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
0.254
</td>
<td
class=
"details-col-elapsed"
>
xiaohesheng
</td>
</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
</td>
<td
class=
"details-col-elapsed"
>
0.635
</td>
<td
class=
"details-col-elapsed"
>
xiaohesheng
</td>
</tr>
...
...
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