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
fcef3bc9
Commit
fcef3bc9
authored
Oct 16, 2023
by
xiao-hesheng
Browse files
新增公告相关脚本
parent
80385be8
Changes
10
Hide whitespace changes
Inline
Side-by-side
air_case/a2_herp3_bs/a10_新增公告_中心库.air/a10_新增公告_中心库.py
0 → 100644
View file @
fcef3bc9
# -*- encoding=utf8 -*-
from
common.db.sql.sql_del_branch_info
import
delByBranchId
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a10_新增公告_中心库,id2263,id2263-10,sit,on
主数据平台:a10_新增公告_中心库
"""
from
common.common_func
import
commonFuc
from
air_case.a1_herp3_login.登录内网系统.登录内网系统
import
login_system
module
=
"a2_herp3_bs"
def
add_notices
():
"""
场景:a10_新增公告_中心库
用例名称:a10_新增公告_中心库
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
#a10_新增公告_中心库
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"save_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
expireDate
=
timeUtils
().
get_time_add
(
30
)
# print(expireDate)
#请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload5"
,
expireDate
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
#断言
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict2"
)
commonFuc
().
check_result
(
check_dict
,
result
)
add_notices
()
air_case/a2_herp3_bs/a1_医院信息登记.air/a1_医院信息登记.py
View file @
fcef3bc9
...
...
@@ -3,7 +3,7 @@
__author__
=
"xiaohesheng"
"""
case_tag:api,
mdm-
herp,a1_医院信息登记,id2263,id2263-1,sit,on
case_tag:api,herp
-web
,a1_医院信息登记,id2263,id2263-1,sit,on
主数据平台:a1_医院信息登记
"""
...
...
air_case/a2_herp3_bs/a7_启用院区.air/a7_启用院区.py
View file @
fcef3bc9
# -*- encoding=utf8 -*-
from
common.db.sql.sql_del_branch_info
import
delByBranchId
__author__
=
"xiaohesheng"
...
...
@@ -47,4 +48,6 @@ def enable_branch():
#断言
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict"
)
commonFuc
().
check_result
(
check_dict
,
result
)
enable_branch
()
\ No newline at end of file
return
branch_id
branch_id
=
enable_branch
()
delByBranchId
().
Delete_branch_by_id
(
branch_id
)
\ No newline at end of file
air_case/a2_herp3_bs/a8_新增公告_全部.air/a8_新增公告_全部.py
0 → 100644
View file @
fcef3bc9
# -*- encoding=utf8 -*-
from
common.db.sql.sql_del_branch_info
import
delByBranchId
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a8_新增公告_全部,id2263,id2263-8,sit,on
主数据平台:a8_新增公告_全部
"""
from
common.common_func
import
commonFuc
from
air_case.a1_herp3_login.登录内网系统.登录内网系统
import
login_system
from
airtest.core.api
import
using
import
sys
from
common.fileUtls
import
FileUtils
module
=
"a2_herp3_bs"
def
add_notices
():
"""
场景:a8_新增公告_全部
用例名称:a8_新增公告_全部
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
#a8_新增公告_全部
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"save_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
expireDate
=
timeUtils
().
get_time_add
(
30
)
# print(expireDate)
#请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload3"
,
expireDate
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
#断言
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict2"
)
commonFuc
().
check_result
(
check_dict
,
result
)
add_notices
()
air_case/a2_herp3_bs/a9_新增公告_全院.air/a9_新增公告_全院.py
0 → 100644
View file @
fcef3bc9
# -*- encoding=utf8 -*-
from
common.db.sql.sql_del_branch_info
import
delByBranchId
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a9_新增公告_全院,id2263,id2263-9,sit,on
主数据平台:a9_新增公告_全院
"""
from
common.common_func
import
commonFuc
from
air_case.a1_herp3_login.登录内网系统.登录内网系统
import
login_system
module
=
"a2_herp3_bs"
def
add_notices
():
"""
场景:a9_新增公告_全院
用例名称:a9_新增公告_全院
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
#a9_新增公告_全院
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"save_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
expireDate
=
timeUtils
().
get_time_add
(
30
)
# print(expireDate)
#请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload4"
,
expireDate
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
#断言
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict2"
)
commonFuc
().
check_result
(
check_dict
,
result
)
add_notices
()
common/db/sql/sql_del_branch_info.py
View file @
fcef3bc9
...
...
@@ -5,7 +5,7 @@ import pymysql
class
delByBranchId
(
object
):
def
Delete_branch_by_
name
(
self
,
id
):
def
Delete_branch_by_
id
(
self
,
id
):
connection
=
pymysql
.
connect
(
host
=
"10.17.65.108"
,
user
=
"root"
,
password
=
"Gyxc.2023"
,
database
=
"spd3_herp_test2"
,
charset
=
"utf8"
)
cursor
=
connection
.
cursor
()
...
...
common/timeUtils.py
View file @
fcef3bc9
from
common.db.db
import
dbOP
import
datetime
from
datetime
import
timedelta
,
date
# 数据读入和写入文件
class
timeUtils
(
object
):
...
...
@@ -9,4 +9,10 @@ class timeUtils(object):
'''2023-05-06 09:39:30'''
import
time
t
=
time
.
strftime
(
"%Y-%m-%d %H:%M:%S"
,
time
.
localtime
())
return
t
def
get_time_add
(
self
,
days_aa
):
import
time
# t = time.strftime("%Y-%m-%d", datetime.datetime.now())
t
=
(
date
.
today
()
+
timedelta
(
days
=
days_aa
)).
strftime
(
"%Y-%m-%d %H:%M:%S"
)
return
t
\ No newline at end of file
data/a1_herp3_login/data
View file @
fcef3bc9
...
...
@@ -18,7 +18,7 @@ json_headers2: {
"passwd": "%s",
"verifyCodeId": "%s",
"verifyCode": "",
"projectCode": "h
di
.pc"
"projectCode": "h
erp
.pc"
}
"payload2": {
...
...
data/a2_herp3_bs/data
View file @
fcef3bc9
...
...
@@ -5,6 +5,7 @@
"insert_url": "/hospitaltest2api/platformService/basic/branch/insert/"
"page_url": "/hospitaltest2api/platformService/basic/branch/page/"
"edit_url": "/hospitaltest2api/platformService/basic/branch/edit/"
"save_url": "/hospitaltest2api/platformService/basic/notice/save"
"username": "xhs1009"
"password": "1qaz!QAZ"
"X-APP-CODE": "herp.pc"
...
...
@@ -62,6 +63,12 @@ json_headers2: {
"ybFlag": "0",
"address": "东土城路院区"
}
"payload3": {"content":"<p>test</p>","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"0","noticeType":1,"title":"test","topFlag":"0"}
"payload4": {"content":"<p>test</p>","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"1","noticeType":1,"title":"test","topFlag":"0"}
"payload5": {"content":"<p>test</p>","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"2","noticeType":1,"title":"test","topFlag":"0"}
checkDict: {"code": 0,'msg': None,'data': True}
checkDict1: {
"code": 0,
...
...
@@ -121,8 +128,8 @@ checkDict1: {
checkDict: {"code": 0,'msg': None,'data':1}
checkDict
1
: {"code": 400,'msg': '供销关系已存在!请勿重复添加','data':None}
checkDict
2
: {"code": 400,'msg': None,'data':None}
checkDict
3
: {'code': 400, 'msg': '数据更新不成功,可能数据的版本不一致!请刷新页面重试', 'data': None}
checkDict
4
: {'code': 0, 'msg': None, 'data': []}
checkDict
2
: {"code": 0,'msg': None,'data':1}
checkDict
3
: {"code": 400,'msg': '供销关系已存在!请勿重复添加','data':None}
checkDict
4
: {"code": 400,'msg': None,'data':None}
checkDict
5
: {'code': 400, 'msg': '数据更新不成功,可能数据的版本不一致!请刷新页面重试', 'data': None}
checkDict
6
: {'code': 0, 'msg': None, 'data': []}
report/summary.html
View file @
fcef3bc9
...
...
@@ -56,7 +56,7 @@
<tr
width=
"600"
>
<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'
>
0分
1
秒
</td>
<td
class=
"details-col-elapsed"
>
100.0%
</td>
</tr>
</table>
...
...
@@ -72,9 +72,9 @@
</tr>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/a
7_启用院区
/log.html'
target=
'_blank'
>
a
7_启用院区
</a></td>
<td
class=
"details-col-elapsed"
><a
href=
'../log/a
10_新增公告_中心库
/log.html'
target=
'_blank'
>
a
10_新增公告_中心库
</a></td>
<td
class=
"success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
0.799
</td>
<td
class=
"details-col-elapsed"
>
1.066
</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