Commit 0ff898ca authored by liguangyu06's avatar liguangyu06
Browse files

用例新增:电商下单时间排序功能验证_返利使用报表列表_升序

parent 5582802a
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc电商下单时间排序功能验证_返利使用报表列表_升序,34,34-31,sit,be
主数据平台:后台运营系统获取返利使用报表列表接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
from common.db.db import mySql
import requests
import json
module = "cmdc_34st"
# 第一步登录后台运营系统获取token
username = commonFuc().get_business_data(module, "username_do_be")
password = commonFuc().get_business_data(module, "password_do_be")
# 获取登录后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, "url31")
request_body = commonFuc().get_business_data(module, "payload31")
"""
场景: 电商下单时间排序功能验证_返利使用报表列表_升序
用例名称:电商下单时间排序功能验证_返利使用报表列表_升序
输出:{"demandCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取返利使用报表信息
result = json.loads(result.content)
result = {"demandCode": result["data"]["list"][0]["demandCode"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 数据库操作
mysql_handle = mySql()
# 获取conf.ini文件中配置的数据库信息
host, port, user, pwd = mysql_handle.getConf(db="cmdc_db_be")
# 在数据库中按电商下单时间升序查询对应的返利使用信息
sql = "select demandCode from (select createTime, demandCode " \
" from (select subtd.demandCode, td.createTime from tc_jde_580_jde jd inner join tc_demand_sub_sku subsku " \
" on jd.demandSubCode = subsku.demandSubCode and jd.SDKCOO = subsku.sellerCompanyCode and " \
" jd.SDLTTR < 980 and jd.subLineNumber = subsku.subLineNumber " \
" inner join tc_demand_sub subtd on subsku.demandSubCode = subtd.demandSubCode " \
" inner join tc_demand td on jd.demandCode = td.demandCode " \
" inner join tc_demand_main main on subsku.demandParentId = main.demandParentId " \
" left join tc_manufacturer_user mu on mu.id = subsku.manufacturerUserId " \
" left join tc_manufacturer_product mp on mp.id = subsku.manufacturerProductId " \
" where subtd.demandId is not null " \
" and subtd.sellerCompanyCode = '00102' " \
" and ((subsku.promotionPrice is not null and subsku.promotionPrice > 0) or (subtd.rebateAmount > 0)) " \
" order by td.createTime desc) tmp_count) t order by createTime asc"
demandCode = mysql_handle.selectSql(host, port, user, pwd, "cmdc-order", sql)[0][0]
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict31", demandCode)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_variable_exist(check_dict, result)
......@@ -99,9 +99,17 @@ checkDict39: {"taskName":"%s"}
#预期结果
checkDict40: {"taskName":"%s"}
#测试场景31:电商下单时间排序功能验证_返利使用报表列表_升序
"url31": "/order/public/getDemandSaleVo"
"payload31": {"sortKey":"createTime","sortValue":1,"saleType":2,"pageStart":1,"pageSize":10}
#预期结果
checkDict31: {"demandCode":"%s"}
#测试场景32:电商下单时间排序功能验证_返利使用报表列表_降序
"url32": "/order/public/getDemandSaleVo"
"payload32": {"sortKey":"createTime","sortValue":2,"saleType":2,"pageStart":1,"pageSize":10}
#预期结果
checkDict32: {"demandCode":"%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