Commit c93ee8c9 authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

parent ebf82e30
......@@ -8,6 +8,7 @@ case_tag:cmdc_api,cmdc返利审核列表获取验证,2271,2271-19,sit,bs
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
from common.db.db import mySql
import requests
import json
......@@ -34,9 +35,27 @@ request_body = commonFuc().get_business_data(module, "payload8")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict8")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 获取列表总数量
total = result["data"]["total"]
# print(total)
# 数据库操作
mysql_handle = mySql()
# 获取conf.ini文件中配置的数据库信息
host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 数据库查询待审核返利规则数量
sql = "SELECT t.rebateId FROM `cmdc-order`.tc_rebate t WHERE deleteSign = 0 and isAudit = 1 and auditLevel =2"
result = {"total": len(mysql_handle.selectSql(host, port, user, pwd, "cmdc-order", sql))}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict8_1", total)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
\ No newline at end of file
......@@ -71,9 +71,10 @@ checkDict7: {"success":true,"code":"200","message":"OK"}
#测试场景八:返利审核列表获取验证
"url8": "/order/rebate/queryRebateReviewByPage"
"payload8": {"rebateName":"","createname":null,"auditstatus":null,"pageSize":10,"pageNum":1,"pageTotal":null,"firstQuery":true,"flag":true,"auditlevel":null,"rebatename":""}
"payload8": {"rebateName":"","createname":null,"auditstatus":"","pageSize":10,"pageNum":1,"pageTotal":null,"firstQuery":true,"flag":true,"auditlevel":2,"rebatename":""}
#预期结果
checkDict8: {"success":true,"code":"200","message":"OK"}
checkDict8_1: {"total":"%s"}
#测试场景九:列表查询条件验证_返利审核
"url9": "/order/rebate/queryRebateReviewByPage"
......
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