Commit 09aa6f62 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

优化脚本

parent 5214e01e
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delData
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,a_c8_期初录入_列表查询_分页查询,id2297,id2297-28,sit,on
内网:a_c8_期初录入_列表查询_分页查询
"""
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 = "b3_herp3_purchase"
"""
场景:a_c8_期初录入_列表查询_分页查询
用例名称:a_c8_期初录入_列表查询_分页查询
输入:无
输出:"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)
# 从文件中获取院区id
branchId = commonFuc().get_business_data(module, 'branchId')
# # #获取日期
# date1=timeUtils().get_time_hms(2)
# date2=timeUtils().get_time_add(-1)
# print(date1,date2)
hospitalId = commonFuc().get_business_data(module, "hospitalId")
branchId = commonFuc().get_business_data(module, "branchId")
# 分页查询
str = commonFuc().get_business_data(module, 'data6')
list2 = list(str.split(","))
print('list2', list2)
for i in list2:
# # 请求体
request_body = commonFuc().get_business_data(module, "payload_12_5", 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)
pageSize = commonFuc().analysis_json('pageSize', data)
if code == 0 and pageSize == int(i):
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
test1()
...@@ -67,5 +67,6 @@ json_headers2: { ...@@ -67,5 +67,6 @@ json_headers2: {
"payload_12_2": {"pageNum":1,"pageSize":50,"queryObject":{"tbStatus":"%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_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"}} "payload_12_4": {"pageNum":1,"pageSize":50,"queryObject":{"orderNo":"","purMode":"%s","hosId":"%s","branchId":"%s"}}
"payload_12_5": {"pageNum":1,"pageSize":"%s","queryObject":{"orderNo":"","hosId":"%s","branchId":"%s"}}
checkDict2: {"code": 0,'msg': None,'data':1} checkDict2: {"code": 0,'msg': None,'data':1}
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