# -*- encoding=utf8 -*-
__author__ = "zhouniandong"

"""
case_tag:cmdc_api,cmdc信息中心所有买家购物车列表,2252,2252-11,sit,bs
主数据平台:多采商城消息中心接口 
"""

from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import json


module = "cmdc_message_center"

# 登录多采商城添加商品至购物车列表
# 获取登录所需账号密码
username1 = commonFuc().get_business_data(module, "username")
password1 = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token1 = CmdcMaiiLogin(username1, password1).get_token()
headers1 = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token1)
# print(headers1)
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url9")
print(url1)
request_body1 = commonFuc().get_business_data(module, "payload9")
"""
 场景:消息中心
 用例名称：信息中心所有买家购物车列表(消息中心）
 输出：{"success":true,"code":"200","message":"OK","data":"ok"}
"""
# 发送请求
result1 = requests.post(url1, json=request_body1, headers=headers1)
#print("\033[031mresult1============\033[0m",result1)
result1 = json.loads(result1.content)
#print("\033[031mresult2============\033[0m",result1)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict9")
#print("\033[031mcheckDict1============\033[0m",checkDict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result1)
