Commit f3bce635 authored by liguangyu06's avatar liguangyu06
Browse files

用例新增:列表查询条件验证_客户采购计划

parent 2b795033
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc列表查询条件验证_客户采购计划,2295,2295-80,sit,bs
主数据平台:后台运营系统获取客户采购计划列表接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import random
import requests
import json
import datetime
module = "cmdc_order_list"
# 第一步登录后台运营系统获取token
username = commonFuc().get_business_data(module, "username2")
password = commonFuc().get_business_data(module, "password2")
# 获取登录后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, "url79")
request_body = commonFuc().get_business_data(module, "payload79")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
pro_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取客户采购计划信息
startTime = result["data"]["list"][pro_random]["createTime"][:10] + " 00:00:00"
customerInfo = result["data"]["list"][pro_random]["customerCode"]
procurementDate = result["data"]["list"][pro_random]["procurementDate"]
lockSign = result["data"]["list"][pro_random]["lockSign"]
mergeSign = result["data"]["list"][pro_random]["mergeSign"]
now_time = endTime = str(datetime.datetime.now().strftime("%Y-%m-%d")) + " 00:00:00"
# 第三步进行列表查询条件验证
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url80")
request_body = commonFuc().get_business_data(module, "payload80", startTime, now_time, customerInfo, startTime,
now_time, procurementDate, lockSign, mergeSign)
"""
场景: 列表查询条件验证_客户采购计划
用例名称:列表查询条件验证_客户采购计划
输出:{"customerCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取查询结果中客户采购计划信息
result = json.loads(result.content)
result = {"customerCode": result["data"]["list"][0]["customerCode"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict80", customerInfo)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -543,7 +543,11 @@ checkDict78: {"success":true,"code":"200"}
#预期结果
checkDict79: {"success":true,"code":"200","message":"OK"}
#测试场景八十:列表查询条件验证_客户采购计划
"url80": "/order/public/procurement/queryProcurementPage"
"payload80": {"startTime":"%s","endTime":"%s","customerInfo":"%s","procurementTime":["%s","%s"],"procurementDate":"%s","lockSign":"%s","mergeSign":"%s","pageStart":1,"pageSize":10,"total":null}
#预期结果
checkDict80: {"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