Commit 65c97ba3 authored by liguangyu06's avatar liguangyu06
Browse files

新增返利规则客户范围接口相关用例

parent 47f17949
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc列表查询条件验证_客户范围,2271,2271-27,sit,bs
主数据平台:后台运营系统返利规则商品客户范围查询接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import random
import json
module = "cmdc_rebate"
# 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
# 第二步获取返利规则对应的客户范围
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url13")
request_body = commonFuc().get_business_data(module, "payload13")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成一个随机数字,用于后续随机选择某一条客户信息
customer_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取返利规则中客户范围列表中某一条客户信息
customer_name = result["data"]["list"][customer_random]["customername"]
customer_code = result["data"]["list"][customer_random]["customercode"]
# 第三步进行条件查询验证
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url14")
request_body = commonFuc().get_business_data(module, "payload14", customer_name, customer_code)
"""
场景: 验证返利规则对应的客户范围列表查询条件是否可以正常使用
用例名称:列表查询条件验证_客户范围
输出:{"customercode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取查询结果对应的客户编号
result = {"customercode": result["data"]["list"][0]["customercode"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict14", customer_code)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
...@@ -24,6 +24,7 @@ headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_toke ...@@ -24,6 +24,7 @@ headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_toke
# 第二步获取返利审核信息 # 第二步获取返利审核信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url8") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url8")
request_body = commonFuc().get_business_data(module, "payload8") request_body = commonFuc().get_business_data(module, "payload8")
""" """
场景: 验证是否可以正常获取返利审核列表 场景: 验证是否可以正常获取返利审核列表
用例名称:返利审核列表获取验证 用例名称:返利审核列表获取验证
......
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc返利规则商品客户范围查询验证,2271,2271-25,sit,bs
主数据平台:后台运营系统返利规则商品客户范围查询接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import json
module = "cmdc_rebate"
# 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
# 第二步获取返利规则对应的客户范围
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url13")
request_body = commonFuc().get_business_data(module, "payload13")
"""
场景: 验证返利规则是否可以正常查看对应的客户范围
用例名称:返利规则商品客户范围查询验证
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict13")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
...@@ -108,9 +108,17 @@ checkDict11: {"success":true,"code":"200","message":"OK"} ...@@ -108,9 +108,17 @@ checkDict11: {"success":true,"code":"200","message":"OK"}
#预期结果 #预期结果
checkDict12: {"productname":"%s"} checkDict12: {"productname":"%s"}
#测试场景十四:返利规则商品客户范围查询验证
"url13": "/order/rebateUser/getList"
"payload13": {"templateId":null,"customername":"","customercode":"","pageNum":1,"pageTotal":0,"pageSize":10,"rebateid":111}
#预期结果
checkDict13: {"success":true,"code":"200","message":"OK"}
#测试场景十五:列表查询条件验证_客户范围
"url14": "/order/rebateUser/getList"
"payload14": {"templateId":null,"customername":"%s","customercode":"%s","pageNum":1,"pageTotal":1,"pageSize":10,"rebateid":111}
#预期结果
checkDict14: {"customercode":"%s"}
......
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