An error occurred while loading the file. Please try again.
An error occurred while loading the file. Please try again.
An error occurred while loading the file. Please try again.
-
周念东 authored6749ff45
# -*- encoding=utf8 -*-
__author__ = "zhouniandong"
"""
case_tag:cmdc_api,cmdc消息中心客户站点列表,1101-2,1001-2-5,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, "url5")
print(url1)
request_body1 = commonFuc().get_business_data(module, "payload5")
"""
场景:消息中心
用例名称:消息中心客户站点列表(消息中心)
输出:{"success":true,"code":"200","message":"OK","data":"ok"}
"""
# 发送请求
result1 = requests.get(url1, params=request_body1, headers=headers1)
#print("\033[031mresult1============\033[0m",result1)
#result1 = json.loads(result1.content)
# 获取接口响应时间
api_time = float(result1.elapsed.total_seconds())
result1 = json.loads(result1.content)
result1["api_time"] = api_time
print(api_time)
#print("\033[031mresult2============\033[0m",result1)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict5")
#print("\033[031mcheckDict1============\033[0m",checkDict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result1)