Commit de23c115 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

优化脚本

parent 92ec156b
......@@ -9,48 +9,52 @@ case_tag:api,mdm-core,a_a4_流程四_基础模块设置,id2302,id2302-4,sit,on
主数据平台:a_a3_流程三_产品导入和审批
"""
from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from airtest.core.api import using
import sys
import time
module = "b5_spd3_core_business_flow"
def test1():
#院区新增
# 院区新增
execute_command("python runner_test.py tag id2263-4 debug sit")
#新增科室
execute_command("python runner_test.py tag id2263-19,id2263-20,id2263-21,id2263-22,id2263-23,id2263-24,id2263-25,id2263-26 debug sit")
#一键导入所有产品
# 新增科室
execute_command(
"python runner_test.py tag id2263-19,id2263-20,id2263-21,id2263-22,id2263-23,id2263-24,id2263-25,id2263-26 debug sit")
# 一键导入所有产品
execute_command("python runner_test.py tag id2263-48 debug sit")
#r_b8库房管理_库区设置_同步库房信息
# r_b8库房管理_库区设置_同步库房信息
execute_command("python runner_test.py tag id2263-221 debug sit")
#新增用户
# 新增用户
execute_command("python runner_test.py tag id2263-253 debug sit")
# 根据院区名称查询中心库房id
execute_command("python runner_test.py tag id2263-222 debug sit")
# 新增库区
execute_command("python runner_test.py tag id2263-226 debug sit")
#查询库区
# 查询库区
execute_command("python runner_test.py tag id2263-228 debug sit")
# r_d0库房管理_库区设置_人员管理_添加人员_查询人员
execute_command("python runner_test.py tag id2263-233 debug sit")
#r_d2库房管理_库区设置_人员管理_添加人员
# r_d2库房管理_库区设置_人员管理_添加人员
execute_command("python runner_test.py tag id2263-235 debug sit")
#r_d4库房管理_库区设置_货位管理_添加货位
# r_d4库房管理_库区设置_货位管理_添加货位
execute_command("python runner_test.py tag id2263-237 debug sit")
#科室管理-科室人员查询 设置科室负责人
# 科室管理-科室人员查询 设置科室负责人
execute_command("python runner_test.py tag id2263-219 debug sit")
def test2():#科室添加产品信息(产品是从外网同步过来的)
def test2(): # 科室添加产品信息(产品是从外网同步过来的)
module = "b2_herp3_bs"
#内网登录
# 内网登录
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()
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
#
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "basic_mcmsGoodsInfo_insert")
......@@ -60,20 +64,20 @@ def test2():#科室添加产品信息(产品是从外网同步过来的)
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
list2 = []
i=1
i = 1
while True:
if i==1000:
if i == 1000:
print('6000秒过去了,产品还没过来,检查同步是否正常')
break
try:
for i in range(1,6):
info = FileUtils().r_info8('b5_spd3_core_business_flow', "产品审核信息",'message%s'%i)
for i in range(1, 6):
info = FileUtils().r_info8('b5_spd3_core_business_flow', "产品审核信息", 'message%s' % i)
hosGoodsId = info['hosGoodsId']
list2.append(hosGoodsId)
except:
print('产品没有同步过来,等待6秒')
time.sleep(6)
i=i+1
i = i + 1
continue
else:
break
......@@ -81,66 +85,81 @@ def test2():#科室添加产品信息(产品是从外网同步过来的)
dept2_id = FileUtils().r_info(module, '科室信息')["dept2_id"]
for i in list2:
# 请求体
request_body = commonFuc().get_business_data(module, "payload58_6",dept2_id,i)
request_body='['+str(request_body)+']'
request_body = commonFuc().get_business_data(module, "payload58_6", dept2_id, i)
request_body = '[' + str(request_body) + ']'
new_request_body = request_body.replace("'", '"')
print(new_request_body)
import json
request_body_json = json.loads(new_request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body_json,headers)
result = commonFuc().http_post(url, request_body_json, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
#断言
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
code=commonFuc().analysis_json('code',result)
data=commonFuc().analysis_json('data',result)
if code==0 and data==1:
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
if code == 0 and data == 1:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
def dept_query_all(): #科室查询,将科室id写入文件中
def dept_query_all(): # 科室查询,将科室id写入文件中
module = "b2_herp3_bs"
#内网登录
# 内网登录
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()
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#b9_科室管理_科室登记_科室查询
# b9_科室管理_科室登记_科室查询
branch_id = FileUtils().r_info(module, '院区新增')["branch_id"]
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "deptPage_url")
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "deptPage_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"))
# #请求体
request_body=commonFuc().get_business_data(module, "payload13",branch_id)
request_body = commonFuc().get_business_data(module, "payload13", branch_id)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url,request_body,headers)
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
data = commonFuc().analysis_json('data', result)
total= commonFuc().analysis_json('total',data)
if total==4:
total = commonFuc().analysis_json('total', data)
if total == 4:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
#将deptid写入文件
# 将deptid写入文件
data1 = commonFuc().analysis_json('data', data)
print('data1',data1)
info=[]
print('data1', data1)
info = []
for i in data1:
deptid = commonFuc().analysis_json('id', i)
info.append(deptid)
titlename=['deptid1','deptid2','deptid3','deptid4']
FileUtils().w_info8(info, module, '所有科室id',titlename,'message6')
titlename = ['deptid1', 'deptid2', 'deptid3', 'deptid4']
FileUtils().w_info8(info, module, '所有科室id', titlename, 'message6')
def grants_user(orgName='d69a68df361a4289b2262e4ef75b55a5',mgrRangeId='feb0cc16618c437fb4d033cd339a0377'):
def grants_user(orgName='d69a68df361a4289b2262e4ef75b55a5', mgrRangeId='feb0cc16618c437fb4d033cd339a0377'):
module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8(module, "用户名信息", 'message3')
print(info)
username1 = info['username1']
username = username1
## print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token1, projectCode1, uxid1, corpId1, info1 = login_system(username, password).get_token()
# 登录获取用户id等信息,使用创建的用户登录============结束
# 内网登录
username = commonFuc().get_business_data(module, "username")
## print('医院名称',username)
......@@ -155,9 +174,19 @@ def grants_user(orgName='d69a68df361a4289b2262e4ef75b55a5',mgrRangeId='feb0cc166
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
userId = uxid1
mgrBranchId = FileUtils().r_info(module, '院区新增')["branch_id"]
mgrBranchName = FileUtils().r_info(module, '院区新增')["branch_name"]
deptid1 = FileUtils().r_info8(module, '所有科室id','message6')["deptid1"]
deptid2 = FileUtils().r_info8(module, '所有科室id','message6')["deptid2"]
deptid3 = FileUtils().r_info8(module, '所有科室id','message6')["deptid3"]
deptid4 = FileUtils().r_info8(module, '所有科室id','message6')["deptid4"]
# # 请求体
request_body = commonFuc().get_business_data(module, "payload63_12_2", orgName,mgrRangeId)
request_body = commonFuc().get_business_data(module, "payload63_12_2", userId, mgrBranchId, mgrBranchName, deptid1,
mgrBranchId, mgrBranchName, deptid2, mgrBranchId, mgrBranchName,
deptid3, mgrBranchId, mgrBranchName, deptid4
)
print('request_body', request_body)
# # # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
......@@ -165,16 +194,16 @@ def grants_user(orgName='d69a68df361a4289b2262e4ef75b55a5',mgrRangeId='feb0cc166
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
if code == 0 and data == 2:
if code == 0 and data >= 2:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
try:
test1()
test2()
dept_query_all()
# grants_user()
# test1()
# test2()
# dept_query_all()
grants_user()
except:
commonFuc().check_text_exist('1','2')
commonFuc().check_text_exist('1', '2')
......@@ -461,7 +461,7 @@ json_headers2: {
"payload63_11": {"userCode":"%s","cname":"%s","tel":"xhs0301","orgCode":"001","orgId":"%s","id":"%s","enableFlag":"1","roleCode":"ro00442","projectCode":"herp","erpCode":"%s_update"}
"payload63_12": {"roleCode":"ro00442","userId":"h0347_UID-051050","projectCode":"herp","grantInfos":[{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-2011","mgrBranchName":"东土城院区","mgrRangeId":"%s","mgrRangeName":"001","roleCode":"ro00442"},{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-2011","mgrBranchName":"东土城院区","mgrRangeId":"%s","mgrRangeName":"008","roleCode":"ro00442"}]}
"payload63_12_2": {"roleCode":"ro00442","userId":"%s","projectCode":"herp","grantInfos":[{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-3492","mgrBranchName":"东土城路院区9Rqb*","mgrRangeId":"b9bff6c3f73e49988f917ce17d8c7dc9","mgrRangeName":"二级检验科002","roleCode":"ro00442"},{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-3492","mgrBranchName":"东土城路院区9Rqb*","mgrRangeId":"d2f0004e6aa947c7a5dfed90bfd2a11f","mgrRangeName":"设备科001","roleCode":"ro00442"},{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-3492","mgrBranchName":"东土城路院区9Rqb*","mgrRangeId":"b7844205bc8a4610b2a382d2baed8bbc","mgrRangeName":"三级检测组003","roleCode":"ro00442"},{"corpId":"h0347","corpName":"","mgrBranchId":"h0347-3492","mgrBranchName":"东土城路院区9Rqb*","mgrRangeId":"bdf679e54f8949f98869484d29dff6dc","mgrRangeName":"科室004","roleCode":"ro00442"}]}
"payload63_12_2": {"roleCode":"ro00442","userId":"%s","projectCode":"herp","grantInfos":[{"corpId":"h0347","corpName":"","mgrBranchId":"%s","mgrBranchName":"%s","mgrRangeId":"%s","mgrRangeName":"设备科001","roleCode":"ro00442"},{"corpId":"h0347","corpName":"","mgrBranchId":"%s","mgrBranchName":"%s","mgrRangeId":"%s","mgrRangeName":"二级检验科002","roleCode":"ro00442"},{"corpId":"h0347","corpName":"","mgrBranchId":"%s","mgrBranchName":"%s","mgrRangeId":"%s","mgrRangeName":"三级检测组003","roleCode":"ro00442"},{"corpId":"h0347","corpName":"","mgrBranchId":"%s","mgrBranchName":"%s","mgrRangeId":"%s","mgrRangeName":"科室004","roleCode":"ro00442"}]}
"payload64": {"pageNum":1,"pageSize":50,"queryObject":{"startTime":"","endTime":""}}
"payload64_1": {"pageNum":1,"pageSize":200,"queryObject":{"methodCode":"S0102","operType":"restful","startTime":"2024-02-28 00:00:00","endTime":"2024-02-29 23:59:59"}}
......
院区新增:
branch_id: h0347-3495
branch_name: 东土城路院区cRaEI
branch_id: h0347-3498
branch_name: 东土城路院区i&FY9
科室信息:
dept2_id: 522d4b2c90f84d799a706943852ce157
dept2_name: 二级检验科002
......@@ -72,9 +72,9 @@
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/a1_医院信息登记/log.html' target='_blank'>a1_医院信息登记</a></td>
<td class="details-col-elapsed"><a href='../log/a_a4_流程四_基础模块设置/log.html' target='_blank'>a_a4_流程四_基础模块设置</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">2.139</td>
<td class="details-col-elapsed">2.562</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