# -*- encoding=utf8 -*-

__author__ = "xiaohesheng"

"""
case_tag:api,herp-web,a2_编辑医院信息,id2263,id2263-2,sit,on
主数据平台:a2_编辑医院信息 
python runner_test.py tag id2263-2 debug sit
"""

from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from airtest.core.api import using
import sys
def h_edit_info():
    module = "b2_herp3_bs"
    """
     场景:a2_编辑医院信息
     用例名称：a2_编辑医院信息
     输入：无
     输出："rtn_msg": data
    """
    #内网登录
    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, "edit_h_info_url")
    url=url+corpId
    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"))

    # 发送请求
    result = commonFuc().http_get(url, headers, params="")
    print('result', result)
    #断言
    code=commonFuc().analysis_json('code',result)
    if code==0:
        commonFuc().check_text_exist(code,result)
    else:
        commonFuc().check_text_exist('error', result)
    # checkDict=commonFuc().get_business_data(module,'checkDict1')
    # commonFuc().check_result(checkDict,result)

h_edit_info()