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

__author__ = "xiaohesheng"

"""
case_tag:api,mdm-web,b17供货关系申请列表查询,id2255,id2255-17,sit,on
主数据平台:b17供货关系申请列表查询 
"""

from common.common_func import commonFuc
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
from airtest.core.api import using
import sys
module = "a4_mdm3_cm"
def test1():
    pro_path = commonFuc().get_pro_path()
    sys.path.append(pro_path + r'\\air_case\\a4_mdm3_cm\\a2供货关系申请_客户类型_医院_登录_企业登录2.air')
    using(pro_path + r'\\air_case\\a4_mdm3_cm\\a2供货关系申请_客户类型_医院_登录_企业登录2.air')
    from a2供货关系申请_客户类型_医院_登录_企业登录 import e_login
    token, projectCode, uxid, corpId, username = e_login()
    """
     场景:b17供货关系申请列表查询
     用例名称：b17供货关系申请列表查询
     输入：无
     输出："rtn_msg": ok
    """
    # module = "mdm3_cm"
    # b17供货关系申请列表查询
    url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVoPage_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, "payload11")
    # # 发送请求
    result = commonFuc().http_post(url, request_body, headers)
    print('result,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
    # # #获取接口返回数据
    code = commonFuc().analysis_json('code', result)
    pageSize = commonFuc().analysis_json('pageSize', commonFuc().analysis_json('data', result))
    if code == 0 and pageSize == 10:
        commonFuc().check_text_exist(code, result)
    else:
        commonFuc().check_text_exist('-1', result)
test1()

