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

__author__ = "xiaohesheng"

"""
case_tag:api,mdm-web,a1企业登录,id2291,id2291-1,sit,on
主数据平台:a1企业登录 
"""

from common.common_func import commonFuc
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
from airtest.core.api import using
import sys
def e_login():
    module = "a6_mdm3_dp"
    # pro_path=commonFuc().get_pro_path()
    # sys.path.append(pro_path+r'\\air_case\\mdm3_pim\\a8产品新增和审核通过.air')
    # using(pro_path+r'\\air_case\\mdm3_pim\\a8产品新增和审核通过.air')
    # from a8产品新增和审核通过 import Enterprise_audit
    # username=Enterprise_audit()
    # info = FileUtils().r_info("a2_mdm3_ea", "企业信息")
    # print(info)
    # username = info['cname']
    # print('aaaaaaaaaaaaaaaaaaaaaaaaaaa',username)

    """
     场景:a1企业登录
     用例名称：a1企业登录
     输入：用户名,密码
     输出："rtn_msg": token
    """
    #从文件中读取用户名
    username=commonFuc().get_business_data(module,'username')
    # print('医院名称',username)
    password = commonFuc().get_business_data(module, "password")
    print(username, password)
    # 获取token和projectCode
    while True:
        try:
            token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
        except:
            continue
        else:
            return token, projectCode, uxid, corpId, username
            # break

e_login()