Commit 47bae5de authored by xiao-hesheng's avatar xiao-hesheng
Browse files

优化脚本

parent 8ca2f922
......@@ -15,7 +15,6 @@ import sys
module = "a4_mdm3_cm"
def supply_and_marketing_apply():
pro_path = commonFuc().get_pro_path()
sys.path.append(pro_path + r'\\air_case\\a4_mdm3_cm\\a2供货关系申请_客户类型_医院_登录_企业登录.air')
......
# -*- encoding=utf8 -*-
from common.db.sql.sql_get_info import sql_get_info
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,a_c3_期初录入_列表_条件查询_精确查询_期初单号,id2301,id2301-23,sit,on
内网:a_c3_期初录入_列表_条件查询_精确查询_期初单号
"""
from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from airtest.core.api import using
import sys
def test1():
module = "b4_herp3_InitStock"
"""
场景:a_c3_期初录入_列表_条件查询_精确查询_期初单号
用例名称:a_c3_期初录入_列表_条件查询_精确查询_期初单号
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
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)
#
url = commonFuc().get_api_url() + commonFuc().get_business_data(module,
"herpService_mcmsInitStock_listVoPage_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"))
print('headers', headers)
# 调用a_a1_期初录入_新增_低值生成一个期初单据
pro_path = commonFuc().get_pro_path()
sys.path.append(pro_path + r'\\air_case\\b4_herp3_InitStock\\a_a1_期初录入_新增_低值.air')
using(pro_path + r'\\air_case\\b4_herp3_InitStock\\a_a1_期初录入_新增_低值.air')
from a_a1_期初录入_新增_低值 import test1
# 从文件读取期初单号_低值
info = FileUtils().r_info8(module, "期初单号信息", 'message1')
list_a = info['list_a']
for i in list_a:
orderNo=i['orderNo']
break
# # 请求体
hospitalId = commonFuc().get_business_data(module, "hospitalId")
branchId = commonFuc().get_business_data(module, "branchId")
# str1 = commonFuc().get_business_data(module, 'status')
# list2 = list(str1.split(","))
# print(list2)
request_body = commonFuc().get_business_data(module, "payload_12_3", orderNo, hospitalId, branchId)
print('request_body', request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data)
tbStatus = commonFuc().analysis_json('tbStatus', data)
if code == 0 and total == 1:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
test1()
# -*- encoding=utf8 -*-
from common.db.sql.sql_get_info import sql_get_info
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,a_c4_期初录入_列表_条件查询_精确查询_耗材类型,id2301,id2301-24,sit,on
内网:a_c4_期初录入_列表_条件查询_精确查询_耗材类型
"""
from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from airtest.core.api import using
import sys
def test1():
module = "b4_herp3_InitStock"
"""
场景:a_c4_期初录入_列表_条件查询_精确查询_耗材类型
用例名称:a_c4_期初录入_列表_条件查询_精确查询_耗材类型
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
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)
#
url = commonFuc().get_api_url() + commonFuc().get_business_data(module,
"herpService_mcmsInitStock_listVoPage_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"))
print('headers', headers)
# 调用a_a1_期初录入_新增_低值生成一个期初单据
pro_path = commonFuc().get_pro_path()
sys.path.append(pro_path + r'\\air_case\\b4_herp3_InitStock\\a_a1_期初录入_新增_低值.air')
using(pro_path + r'\\air_case\\b4_herp3_InitStock\\a_a1_期初录入_新增_低值.air')
from a_a1_期初录入_新增_低值 import test1
hospitalId = commonFuc().get_business_data(module, "hospitalId")
branchId = commonFuc().get_business_data(module, "branchId")
str1 = commonFuc().get_business_data(module, 'data1')
list2 = list(str1.split(","))
# print(list2)
# # 请求体
for i in list2:
request_body = commonFuc().get_business_data(module, "payload_12_4", i, hospitalId, branchId)
print('request_body', request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data)
purMode = commonFuc().analysis_json('purMode', data)
if code == 0 and total >= 1 and purMode == int(i):
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
test1()
......@@ -65,5 +65,7 @@ json_headers2: {
"payload_12": {"pageNum":1,"pageSize":50,"queryObject":{"hosId":"%s","branchId":"%s"}}
"payload_12_1": {"pageNum":1,"pageSize":50,"queryObject":{"stockId":"%s","hosId":"%s","branchId":"%s"}}
"payload_12_2": {"pageNum":1,"pageSize":50,"queryObject":{"tbStatus":"%s","hosId":"%s","branchId":"%s"}}
"payload_12_3": {"pageNum":1,"pageSize":50,"queryObject":{"orderNo":"%s","hosId":"%s","branchId":"%s"}}
"payload_12_4": {"pageNum":1,"pageSize":50,"queryObject":{"orderNo":"","purMode":"%s","hosId":"%s","branchId":"%s"}}
checkDict2: {"code": 0,'msg': None,'data':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分6</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/f3_院区单元包设置_新增单元包/log.html' target='_blank'>f3_院区单元包设置_新增单元包</a></td>
<td class="details-col-elapsed"><a href='../log/a_c4_期初录入_列表_条件查询_精确查询_耗材类型/log.html' target='_blank'>a_c4_期初录入_列表_条件查询_精确查询_耗材类型</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">6.532</td>
<td class="details-col-elapsed">1.31</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