注册医院审核通过.py 4.37 KiB
# -*- encoding=utf8 -*-
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web,注册医院审核通过,id2249,id2249-4,sit,on,20230907
主数据平台:注册医院审核通过
"""
from common.common_func import commonFuc
def reg_and_audit_hospital(type=1):
    module = "a3_mdm3_hs"
    # 注册医院
    url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "insertHosRegistInfo_url")
    # #获取请求头信息
    headers = commonFuc().get_business_data(module, "json_headers",
                                            commonFuc().get_business_data(module, "json_contentType"))
    print(headers)
    h_name = commonFuc().get_business_data(module, "name1")  # 获取前缀name
    h_name = h_name + commonFuc().randomString(5)  # 随机数生成拼接医院名称
    request_body = commonFuc().get_business_data(module, "payload", h_name, h_name, h_name, h_name, h_name, h_name, h_name,
                                                 h_name)
    print(request_body)
    # 发送请求
    result = commonFuc().http_post(url, request_body, headers)
    print(result)
    # 医院审核接口_查询数据_开始
    # 登录
    username = commonFuc().get_business_data(module, "username")
    password = commonFuc().get_business_data(module, "password1")
    print(username, password)
    # 获取token和projectCode
    token, projectCode, uxid,corpId,info = login_system(username, password).get_token()
    url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "queryListPage_url")
    # 获取请求头信息
    headers = commonFuc().get_business_data(module, "json_headers2",
                                            commonFuc().get_business_data(module, "json_contentType"), token,
                                            projectCode)
    request_body = commonFuc().get_business_data(module, "payload2", h_name)
    # 发送请求
    result1 = commonFuc().http_post(url, request_body, headers)
    # 获取接口返回数据
    id1 = commonFuc().analysis_json('id', result1)
    # print('id1',id1)
    code = commonFuc().analysis_json('code', result1)
    # print('code',code)
    # 断言实际结果中是否包含预期结果的内容
    # commonFuc().check_result(code, result)
    # 断言实际结果中是否包含预期的文本
    commonFuc().check_text_exist(code, result1)
    # ===============医院注册提交接口_查询数据_结束
    # 锁定医院
    url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "updateById_url")
    # #获取请求头信息
    headers = commonFuc().get_business_data(module, "json_headers",
                                            commonFuc().get_business_data(module, "json_contentType"))
    # 调用函数获取时间
    now = timeUtils().get_time_hms()
    request_body = commonFuc().get_business_data(module, "payload3", id1, uxid, now)
    # 发送请求
    result = commonFuc().http_post(url, request_body, headers)
    # print('abc',result)
    # 获取预期结果
    check_dict = commonFuc().get_business_data(module, "checkDict")
    # print(check_dict)
717273747576777879808182838485868788899091929394
# #断言实际结果中是否包含预期结果的内容 commonFuc().check_result(check_dict, result) # #=============== 锁定结束 # # #医院注册_审核通过_开始 url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "checkHosRegistInfo_url") # 获取请求头信息 headers = commonFuc().get_business_data(module, "json_headers2", commonFuc().get_business_data(module, "json_contentType"), token, projectCode) request_body = commonFuc().get_business_data(module, "payload4", id1, now, now, h_name, uxid, h_name, h_name, h_name, h_name, h_name, h_name, h_name, now, now, uxid) # 发送请求 result = commonFuc().http_post(url, request_body, headers) # #获取接口返回数据 # code = commonFuc().analysis_json('code', result) check_dict2 = commonFuc().get_business_data(module, "checkDict2") # # #断言实际结果中是否包含预期结果的内容 commonFuc().check_result(check_dict2, result) # #===============医院注册提交接口_审核通过_结束 return h_name reg_and_audit_hospital()