Commit 090f6193 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

优化脚本

parent 2c951f6c
......@@ -5,8 +5,8 @@ from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,a20_新增公告_中心库,id2263,id2263-10,sit,on
主数据平台:a20_新增公告_中心库
case_tag:api,herp-web,a8_新增公告_全部,id2263,id2263-8,sit,on
主数据平台:a8_新增公告_全部
"""
from common.common_func import commonFuc
......@@ -17,8 +17,8 @@ from common.fileUtls import FileUtils
module = "b2_herp3_bs"
def add_notices():
"""
场景:新增公告_中心库
用例名称:a20_新增公告_中心库
场景:a8_新增公告_全部
用例名称:a8_新增公告_全部
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
......@@ -31,7 +31,7 @@ def add_notices():
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")
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "save_url1")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
......@@ -39,10 +39,11 @@ def add_notices():
commonFuc().get_business_data(module, "X-APP-CODE"))
expireDate=timeUtils().get_time_add(30)
title="公告发布测试"
# print(expireDate)
#请求体
request_body=commonFuc().get_business_data(module, "payload3",expireDate)
request_body=commonFuc().get_business_data(module, "payload3",title,expireDate,title)
print('request_body',request_body)
# 发送请求
result = commonFuc().http_post(url, request_body,headers)
print('result', result)
......
......@@ -38,9 +38,10 @@ def add_notices():
commonFuc().get_business_data(module, "X-APP-CODE"))
expireDate=timeUtils().get_time_add(30)
title = "公告发布测试" + commonFuc().randomString(5)
# print(expireDate)
#请求体
request_body=commonFuc().get_business_data(module, "payload4",expireDate)
request_body=commonFuc().get_business_data(module, "payload4",title,expireDate,title)
# 发送请求
result = commonFuc().http_post(url, request_body,headers)
......
......@@ -38,8 +38,9 @@ def add_notices():
expireDate=timeUtils().get_time_add(30)
# print(expireDate)
title = "公告发布测试" + commonFuc().randomString(5)
#请求体
request_body=commonFuc().get_business_data(module, "payload5",expireDate)
request_body=commonFuc().get_business_data(module, "payload5",title,expireDate,title)
# 发送请求
result = commonFuc().http_post(url, request_body,headers)
......
......@@ -38,8 +38,9 @@ def add_notices():
expireDate=timeUtils().get_time_add(30)
# print(expireDate)
title = "公告发布测试" + commonFuc().randomString(5)
#请求体
request_body=commonFuc().get_business_data(module, "payload6",expireDate)
request_body=commonFuc().get_business_data(module, "payload6",title,expireDate,title)
# 发送请求
result = commonFuc().http_post(url, request_body,headers)
......
......@@ -15,7 +15,7 @@ from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "b2_herp3_bs"
def modify_notices():
def del_notices():
"""
场景:b6_删除公告
用例名称:b6_删除公告
......@@ -52,6 +52,6 @@ def modify_notices():
checkDict=commonFuc().get_business_data(module,'checkDict2')
# #断言
commonFuc().check_result(checkDict,result)
modify_notices()
del_notices()
#调用数据库处理类删除发布的公告,是逻辑删除
delByNoticeName().delete_ByNoticeName()
......@@ -29,7 +29,7 @@ def test1():
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# # print('医院名称',username)
# # print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
......
......@@ -551,4 +551,14 @@ class commonFuc(object):
curPath = os.path.abspath(os.path.dirname(__file__)) # 获取当前文件的所在目录的绝对路径
# print(os.path.split(curPath))
rootPath = os.path.split(curPath)[0]
return rootPath
\ No newline at end of file
return rootPath
# 截图
def getPhoto(self,chrome):
import time
# imgName = time.strftime("%Y%m%d_%H%M%S", time.localtime()) + ".png"
imgName = "info.png"
pro_path = self.get_pro_path() # 获取项目的根目录的路径
image_path = pro_path + "//log//" + imgName
chrome.get_screenshot_as_file(image_path)
return imgName, image_path
......@@ -10,7 +10,7 @@ class delByNoticeName(object):
charset="utf8")
cursor = connection.cursor()
# 删除新增的院区数据,减少垃圾数据的产生,保证脚本下次还可以正常运行,接口脚本每次都使用新增数据
sql = "update sys_notice set del_flag=1 where title like '%test%';"
sql = "update sys_notice set del_flag=1 where title like '%公告发布测试%';"
print(sql)
cursor.execute(sql)
cursor.execute("commit;")
......
......@@ -5,6 +5,7 @@
"page_url": "/hospitaltest2api/platformService/basic/branch/page/"
"edit_url": "/hospitaltest2api/platformService/basic/branch/edit/"
"save_url": "/hospitaltest2api/platformService/basic/notice/save"
"save_url1": "/hospitaltest2api/herpService/basic/notice/save"
"page_url1": "/hospitaltest2api/platformService/basic/notice/page"
"update_url": "/hospitaltest2api/platformService/basic/notice/update"
"del_url": "/hospitaltest2api/platformService/basic/notice/del/"
......@@ -91,12 +92,12 @@ json_headers2: {
"ybFlag": "0",
"address": "东土城路院区"
}
"payload3": {"content":"xhstest","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"0","noticeType":1,"title":"xhstest","topFlag":"0"}
"payload4": {"content":"xhstest","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"1","noticeType":1,"title":"xhstest","topFlag":"0"}
"payload5": {"content":"xhstest","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"2","noticeType":1,"title":"xhstest","topFlag":"0"}
"payload6": {"content":"xhstest","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"3","noticeType":1,"title":"xhstest","topFlag":"0"}
"payload7": {"pageNum": 1,"pageSize": 50,"queryObject": {"title": "xhstest","mgrRangeKind": "","publishDateBegin": "", "publishDateEnd": "", "corpId": "h0347"}}
"payload8": {"pageNum": 1,"pageSize": 50,"queryObject": {"title": "xhs","mgrRangeKind": "","publishDateBegin": "", "publishDateEnd": "", "corpId": "h0347"}}
"payload3": {"content":"%s","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"0","noticeType":1,"title":"%s","topFlag":"0"}
"payload4": {"content":"%s","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"1","noticeType":1,"title":"%s","topFlag":"0"}
"payload5": {"content":"%s","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"2","noticeType":1,"title":"%s","topFlag":"0"}
"payload6": {"content":"%s","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"3","noticeType":1,"title":"%s","topFlag":"0"}
"payload7": {"pageNum": 1,"pageSize": 50,"queryObject": {"title": "公告发布测试","mgrRangeKind": "","publishDateBegin": "", "publishDateEnd": "", "corpId": "h0347"}}
"payload8": {"pageNum": 1,"pageSize": 50,"queryObject": {"title": "公告发布","mgrRangeKind": "","publishDateBegin": "", "publishDateEnd": "", "corpId": "h0347"}}
"payload9": {"pageNum": 1,"pageSize": 50,"queryObject": {"title": "不存在的公告","mgrRangeKind": "","publishDateBegin": "", "publishDateEnd": "", "corpId": "h0347"}}
"payload10": {"content": "%s","expireDate": "%s","mgrRangeId": "","title": "%supdate","id": "%s","topFlag": "0","mgrRangeKind": "1","corpId": "h0347","noticeType": 1}
"payload11": {"pageNum": 1,"pageSize": 50,"queryObject": {"hosId": "h0347","searchText": "p56a4","firmType": 1}}
......
......@@ -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分2</td>
<td class='details-col-elapsed'>0分0</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/g8_7添加产品列表_确定添加产品/log.html' target='_blank'>g8_7添加产品列表_确定添加产品</a></td>
<td class="details-col-elapsed"><a href='../log/b6_删除公告/log.html' target='_blank'>b6_删除公告</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">2.508</td>
<td class="details-col-elapsed">0.886</td>
<td class="details-col-elapsed">xiaohesheng</td>
</tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment