Commit f33ec7c1 authored by liguangyu06's avatar liguangyu06
Browse files

新增不存在的商品至常购清单列表场景

parent c9f4691d
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:api,cmdc新增不存在的商品至常购清单列表,2252,2252-5,sit,bs
主数据平台:多彩商城常购清单列表新增商品接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多彩商城登录.多彩商城登录 import CmdcMaiiLogin
import requests
import json
module = "cmdc_frequent_purchase"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url)
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers4", cmdc_access_token)
print(headers)
request_body = commonFuc().get_business_data(module, "payload4")
print(request_body)
"""
场景:新增不存在的商品至常购清单列表
用例名称:新增不存在的商品至常购清单列表
输出:{"success":false,"code":"1078","message":"该商品不存在,加入购物车失败","data":null,"freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict4")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -18,6 +18,21 @@ json_headers1: {
checkDict1: {"success":true,"code":"200","message":"OK","data":"ok"}
#测试场景:新增不存在的商品至用户的常购清单列表
json_headers4: {
"Cmdc_access_token": "%s",
"Sourcetype": "mall"
}
"payload4": {"currentCompanyId":2,"productId":"954647456754764","quantity":1,"agreementPriceId":0,"price":68.88}
#预期结果
checkDict4: {"success":false,"code":"1078","message":"该商品不存在,加入购物车失败","data":null,"freshToken":null}
#获取用户常购清单列表接口地址
"url2": "/product/mall/queryTotalFrequentPurchaseList"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment