# -*- encoding=utf8 -*-
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
from common.common_func import commonFuc
from common.timeUtils import timeUtils
from common.fileUtls import FileUtils
import sys

__author__ = "xiaohesheng"

"""
case_tag:api,mdm-web,查询器械注册人,id2254,id2254-1,sit,on 
主数据平台:查询器械注册人
"""
module = "mdm3_ir"

"""
 场景:查询器械注册人
 用例名称：查询器械注册人
 输入：name
 输出："rtn_msg": "ok"
"""
# 登录
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
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, "listVoPage_url")
print(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, "payload", corpId)

# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('实际值',result)
total=commonFuc().analysis_json('total',commonFuc().analysis_json('data',result))
code=commonFuc().analysis_json('code',commonFuc().analysis_json('data',result))
data=commonFuc().analysis_json('data',commonFuc().analysis_json('data',result))
id1=commonFuc().analysis_json('id',data)

# 断言实际结果中是否包含预期结果的内容
if total>=0:
    commonFuc().check_text_exist(code, result)  # 检查验证码
else:
    commonFuc().check_text_exist(-1, result)
# global_var_id = id1