# -*- encoding=utf8 -*-
from common.fileUtls import FileUtils

__author__ = "xiaohesheng"

"""
case_tag:api,mdm-web,b19医院客户目录维护,id2255,id2255-19,sit,on
主数据平台:b19医院客户目录维护 
"""

from common.common_func import commonFuc
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
from airtest.core.api import using
import sys
module = "a4_mdm3_cm"
def select1():
    module = "a4_mdm3_cm"
    pro_path = commonFuc().get_pro_path()
    sys.path.append(pro_path + r'\\air_case\\a4_mdm3_cm\\a2供货关系申请_客户类型_医院_登录_企业登录2.air')
    using(pro_path + r'\\air_case\\a4_mdm3_cm\\a2供货关系申请_客户类型_医院_登录_企业登录2.air')
    from a2供货关系申请_客户类型_医院_登录_企业登录 import e_login
    token, projectCode, uxid, corpId, e_name = e_login()
    print(token, projectCode, uxid, corpId, e_name)
    print("===================================================")

    """
     场景:b19医院客户目录维护
     用例名称：b19医院客户目录维护
     输入：医院id
     输出："rtn_msg": 0
    """
    module = "a4_mdm3_cm"
    #b18供货目录申请_客户类型_医院_提交供货申请单_添加产品
    url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listHosInfoVoPage_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, "payload13")

    # print('request_body',request_body)
    # 发送请求
    result = commonFuc().http_post(url, request_body, headers)
    print('result', result)
    #断言
    code=commonFuc().analysis_json('code',result)
    if code==0:
        commonFuc().check_text_exist(code,result)
    else:
        commonFuc().check_text_exist('-1', result)

select1()

