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

__author__ = "xiaohesheng"

"""
case_tag:api,mdm-web,b18供货目录查询,id2255,id2255-18,sit,on
主数据平台:b18供货目录查询 
"""

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供货关系申请_客户类型_医院_登录_企业登录.air')
    using(pro_path + r'\\air_case\\a4_mdm3_cm\\a2供货关系申请_客户类型_医院_登录_企业登录.air')
    from a2供货关系申请_客户类型_医院_登录_企业登录 import e_login
    token, projectCode, uxid, corpId, e_name = e_login()
    print(token, projectCode, uxid, corpId, e_name)
    print("===================================================")
    """
     场景:b18供货目录查询
     用例名称：b18供货目录查询
     输入：医院id
     输出："rtn_msg": 0
    """
    #b18供货目录查询
    module = "a4_mdm3_cm"
    url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "getSupplyHosList_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, "payload12")
    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()

