# -*- encoding=utf8 -*-

__author__ = "xiaohesheng"

"""
case_tag:api,mdm-web,企业认领,id2248,id2248-1,sit,on
主数据平台:注册企业审核认领流程 
"""

from common.common_func import commonFuc
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
from airtest.core.api import using
import sys
module = "mdm3_ea"
pro_path=commonFuc().get_pro_path()
sys.path.append(pro_path+r'\\air_case\\mdm3_es\\外网企业注册提交接口_正常注册.air')
using(pro_path+r'\\air_case\\mdm3_es\\外网企业注册提交接口_正常注册.air')
from 外网企业注册提交接口_正常注册 import es
id1,cname=es()
"""
 场景:注册企业认领
 用例名称：企业认领
 输入：CRid
 输出："rtn_msg": "企业被认领"
"""
 #企业注册提交接口_认领
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "updateById_url")
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()
#获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
                                        commonFuc().get_business_data(module, "json_contentType"), token,
                                        projectCode, token)
request_body = commonFuc().get_business_data(module, "payload1",id1)

# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# # print(result)
#获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict")
# print(check_dict)
#断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
#=============== 企业注册提交接口_认领结束
global_var_id = id1
global_var_cname=cname