diff --git "a/air_case/b5_spd3_core_business_flow/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256.air/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256.py" "b/air_case/b5_spd3_core_business_flow/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256.air/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256.py" index be6aafefe9753b0b80331ff65b28ae634b55cac4..44f478c115e430f4bd83cd9c56f9b93fae9b59d4 100644 --- "a/air_case/b5_spd3_core_business_flow/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256.air/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256.py" +++ "b/air_case/b5_spd3_core_business_flow/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256.air/a_a4_\346\265\201\347\250\213\345\233\233_\345\237\272\347\241\200\346\250\241\345\235\227\350\256\276\347\275\256.py" @@ -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') diff --git a/data/b2_herp3_bs/data b/data/b2_herp3_bs/data index 2f82e732f14df0283a163768b6345e71f8e58067..ad20c65b82ff76e66d0216b3b60e5085bfd8a543 100644 --- a/data/b2_herp3_bs/data +++ b/data/b2_herp3_bs/data @@ -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"}} diff --git a/data/b2_herp3_bs/message b/data/b2_herp3_bs/message index 5bc6968add21244d727d0f7c6ea942c0559d2acf..95c5b0d92658e76b15102f5470c3e8ca9455f3d7 100644 --- a/data/b2_herp3_bs/message +++ b/data/b2_herp3_bs/message @@ -1,6 +1,6 @@ 院区新增: - branch_id: h0347-3495 - branch_name: 东土城路院区cRaEI + branch_id: h0347-3498 + branch_name: 东土城路院区i&FY9 科室信息: dept2_id: 522d4b2c90f84d799a706943852ce157 dept2_name: 二级检验科002 diff --git a/report/summary.html b/report/summary.html index 4bc9d5b9e62ab70dcaff25d42c5bd4543c197b86..a78ebea0c44b77a187e225265d33713e73d886a4 100644 --- a/report/summary.html +++ b/report/summary.html @@ -72,9 +72,9 @@ - a1_医院信息登记 + a_a4_流程四_基础模块设置 成功 - 2.139 + 2.562 xiaohesheng