# -*- 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-8,sit,on
主数据平台:添加器械注册人_查询数据
"""
module = "mdm3_ir"
from common.common_func import commonFuc, using
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
pro_path=commonFuc().get_pro_path()
sys.path.append(pro_path+r'\\air_case\\mdm3_ir\\a2器械注册人申报.air')
using(pro_path+r'\\air_case\\mdm3_ir\\a2器械注册人申报.air')
from a2器械注册人申报 import *

sys.path.append(pro_path+r'\\air_case\\mdm3_ir\\a2查询获取器械注册人id.air')
using(pro_path+r'\\air_case\\mdm3_ir\\a2查询获取器械注册人id.air')
from a2查询获取器械注册人id import *

sys.path.append(pro_path+r'\\air_case\\mdm3_ir\\a器械注册人认领.air')
using(pro_path+r'\\air_case\\mdm3_ir\\a器械注册人认领.air')
from a器械注册人认领 import *


# CRID=global_var_CRID
# print(cname,'aaaaaaaaaaaaaaaaaaa')
"""
 场景:添加器械注册人_查询数据
 用例名称：添加器械注册人_查询数据
 输入：id
 输出："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, "queryMdmAndProdCompanyPage_url")
# print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
                                        commonFuc().get_business_data(module, "json_contentType"), token,
                                        projectCode)

canme=global_var_cname
# 发送请求
request_body = commonFuc().get_business_data(module, "payload5", canme,corpId)


result = commonFuc().http_post(url, request_body, headers)

print('添加器械注册人_查询数据',result)
code=commonFuc().analysis_json('code',result)
# #断言实际结果中是否包含预期结果的内容
commonFuc().check_text_exist(code, result)
data=commonFuc().analysis_json('data',result)
data1=commonFuc().analysis_json('data',data)
id1=commonFuc().analysis_json('id',data1)
global_var_id1=id1
# print(global_var_id1,id1)

