Commit 5271a37a authored by 周念东's avatar 周念东
Browse files

20240617

parents ced008e1 c3acdd56
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc收货地址新增验证_代客下单,2295,2295-37,sit,bs
主数据平台:后台运营系统获收货地址新增接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import random
import json
module = "cmdc_order_list"
# 第一步登录后台运营系统获取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, "url33")
request_body = commonFuc().get_business_data(module, "payload33")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
customer_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取客户信息
user_id = result["data"]["list"][customer_random]["userId"]
company_id = "6"
# 第三步新增收货地址
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url42")
request_body = commonFuc().get_business_data(module, "payload42", company_id, user_id)
# print(request_body)
"""
场景: 收货地址新增验证_代客下单
用例名称:收货地址新增验证_代客下单
输出:{"success":true,"code":"200","message":"OK","data":true,"freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 将接口响应时间添加至结果中
result = json.loads(result.content)
# print(result)
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict42")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc收货地址删除功能验证_代客下单,2295,2295-42,sit,bs
主数据平台:后台运营系统收货地址删除接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
from common.db.db import mySql
import requests
module = "cmdc_order_list"
# 第一步登录后台运营系统获取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)
# 数据库操作
mysql_handle = mySql()
# 获取conf.ini文件中配置的数据库信息
host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 查询数据库中收货地址信息
sql = "SELECT t.addressId FROM `cmdc-user`.cmdc_address t " \
"WHERE mobile = 18700000000 and receiverName = '收货地址新增测试' and deleteSign = 0"
address_id = mysql_handle.selectSql(host, port, user, pwd, "cmdc-order", sql)[0][0]
# 第三步进行收货地址删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url43")
request_body = commonFuc().get_business_data(module, "payload43", address_id)
# print(request_body)
"""
场景: 收货地址删除功能验证_代客下单
用例名称:收货地址删除功能验证_代客下单
输出:{"deleteSign":1}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 查询数据库中收货地址删除标识
sql = "SELECT t.deleteSign FROM `cmdc-user`.cmdc_address t WHERE addressId = {}".format(address_id)
result = {"deleteSign": mysql_handle.selectSql(host, port, user, pwd, "cmdc-order", sql)[0][0]}
# 将接口响应时间添加至结果中
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict43")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc销售任务新增验证,2295,2295-67,sit,bs
主数据平台:后台运营系统销售任务新增接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import json
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, "url67")
request_body = commonFuc().get_business_data(module, "payload67")
"""
场景: 销售任务新增验证
用例名称:销售任务新增验证
输出:{"success":true,"code":"200","message":"OK","data":"success","freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 将接口响应时间添加至结果中
result = json.loads(result.content)
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict67")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc销售任务编辑功能验证,2295,2295-68,sit,bs
主数据平台:后台运营系统销售任务编辑接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import json
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, "url68_1")
request_body = commonFuc().get_business_data(module, "payload68_1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取销售任务信息
task_json = result["data"]["list"][0]
# 删除多余字段便于对销售任务进行更新操作
task_json.pop("filialeCode")
task_json.pop("filialeName")
task_json.pop("taskCycle")
task_json.pop("taskDescription")
task_json.pop("useSign")
task_json.pop("deleteSign")
task_json.pop("createTime")
task_json.pop("updateTime")
# 第三步进行销售任务编辑更新操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url68")
request_body = task_json
"""
场景: 销售任务编辑功能验证
用例名称:销售任务编辑功能验证
输出:{"success":true,"code":"200","message":"OK","data":"success","freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 将接口响应时间添加至结果中
result = json.loads(result.content)
# print(result)
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict68")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc销售任务删除功能验证,2295,2295-71,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
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, "url68_1")
request_body = commonFuc().get_business_data(module, "payload68_1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取销售任务信息
supplierSaleTaskId = result["data"]["list"][0]["supplierSaleTaskId"]
# 第三步进行销售任务删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url71")
request_body = commonFuc().get_business_data(module, "payload71", supplierSaleTaskId)
"""
场景: 销售任务删除功能验证
用例名称:销售任务删除功能验证
输出:{"deleteSign":1}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 数据库操作
mysql_handle = mySql()
# 获取conf.ini文件中配置的数据库信息
host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 查询数据库中对应任务删除标识
sql = "SELECT t.deleteSign FROM `cmdc-order`.tc_suppliersale_task t WHERE supplierSaleTaskId = {}".format(supplierSaleTaskId)
result = {"deleteSign": mysql_handle.selectSql(host, port, user, pwd, "cmdc-order", sql)[0][0]}
# 将接口响应时间添加至结果中
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict71")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc销售下发任务启用功能验证,2295,2295-69,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
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)
# 第二步获取销售任务下发列表/已启用
use_sign = 2
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url72")
request_body = commonFuc().get_business_data(module, "payload_use", use_sign)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取任务下发信息
supplierSaleTaskId = result["data"]["list"][0]["supplierSaleTaskId"]
# 第三步进行销售下发任务启用操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url69")
request_body = commonFuc().get_business_data(module, "payload69", supplierSaleTaskId)
"""
场景: 销售下发任务启用功能验证
用例名称:销售下发任务启用功能验证
输出:{"useSign":1}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 数据库操作
mysql_handle = mySql()
# 获取conf.ini文件中配置的数据库信息
host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 查询数据库中对应任务启用状态
sql = "SELECT t.useSign FROM `cmdc-order`.tc_suppliersale_task t WHERE supplierSaleTaskId = {}".format(supplierSaleTaskId)
result = {"useSign": mysql_handle.selectSql(host, port, user, pwd, "cmdc-order", sql)[0][0]}
# 将接口响应时间添加至结果中
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict69")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc销售下发任务停用功能验证,2295,2295-70,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
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)
# 第二步获取销售任务下发列表/已停用
use_sign = 1
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url72")
request_body = commonFuc().get_business_data(module, "payload_use", use_sign)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取任务下发信息
supplierSaleTaskId = result["data"]["list"][0]["supplierSaleTaskId"]
# 第三步进行销售下发任务停用操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url70")
request_body = commonFuc().get_business_data(module, "payload70", supplierSaleTaskId)
"""
场景: 销售下发任务停用功能验证
用例名称:销售下发任务停用功能验证
输出:{"useSign":2}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 数据库操作
mysql_handle = mySql()
# 获取conf.ini文件中配置的数据库信息
host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 查询数据库中对应任务启用状态
sql = "SELECT t.useSign FROM `cmdc-order`.tc_suppliersale_task t WHERE supplierSaleTaskId = {}".format(supplierSaleTaskId)
result = {"useSign": mysql_handle.selectSql(host, port, user, pwd, "cmdc-order", sql)[0][0]}
# 将接口响应时间添加至结果中
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict70")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdcid为空_收货地址删除_代客下单,2295,2295-44,sit,bs
主数据平台:后台运营系统收货地址删除接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import json
module = "cmdc_order_list"
# 第一步登录后台运营系统获取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, "url44")
request_body = commonFuc().get_business_data(module, "payload44")
# print(request_body)
"""
场景: id为空_收货地址删除_代客下单
用例名称:id为空_收货地址删除_代客下单
输出:{"success":true,"code":"200","message":"OK","data":false}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 将接口响应时间添加至结果中
result = json.loads(result.content)
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict44")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc下载资质文件功能验证,2295,2295-64,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
module = "cmdc_order_list"
# # 第一步登录后台运营系统获取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, "url64")
request_body = commonFuc().get_business_data(module, "payload64")
# print(request_body)
"""
场景: 下载资质文件功能验证
用例名称:下载资质文件功能验证
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.get(url, params=request_body)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 将接口响应时间添加至result
result = json.loads(result.content)
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict64")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc传值有效性校验_jde配货合并详情,2295,2295-26,sit,bs
主数据平台:后台运营系统获取jde配货单合并详情接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import random
import json
module = "cmdc_order_list"
# 第一步登录后台运营系统获取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)
# 随机生成无效distributionJdeDsId
distribution_jde_ds_id = random.randint(0, 100)
# 第二步获取jde配货单合并详情
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url26")
request_body = commonFuc().get_business_data(module, "payload26", distribution_jde_ds_id)
"""
场景: 传值有效性校验_jde配货合并详情
用例名称:传值有效性校验_jde配货合并详情
输出:{"success":false,"code":"ERROR","message":"配货单不存在","data":null,"freshToken":null}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
result = json.loads(result.content)
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict26")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc传值有效性校验_jde配货推送,2295,2295-31,sit,bs
主数据平台:后台运营系统获取jde配货推送接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import random
import json
module = "cmdc_order_list"
# 第一步登录后台运营系统获取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)
# 随机生成无效的配货单信息
distribution_jde_ds_id = random.randint(0, 100)
# 第二步jde配货单推送
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url31")
request_body = commonFuc().get_business_data(module, "payload31", distribution_jde_ds_id)
"""
场景: 传值有效性校验_jde配货推送
用例名称:传值有效性校验_jde配货推送
输出:{"success":false,"code":"ERROR","message":"配货单不存在","data":null,"freshToken":null}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
result = json.loads(result.content)
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict31")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc传值有效性校验_获取jde配货单信息,2295,2295-23,sit,bs
主数据平台:后台运营系统获取jde配货单信息接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import random
import json
module = "cmdc_order_list"
# 第一步登录后台运营系统获取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)
# 随机生成无效distributionJdeDsId
distribution_jde_ds_id = random.randint(0, 100)
# 第二步获取jde配货单信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url23")
request_body = commonFuc().get_business_data(module, "payload23", distribution_jde_ds_id)
"""
场景: 传值有效性校验_获取jde配货单信息
用例名称:传值有效性校验_获取jde配货单信息
输出:{"success":true,"code":"200","message":"OK","data":{"status":0,"countSuccess":0,"countFail":1,"message":"第1行,商品编码或物料编码为空!\n","data":[],"maps":null},"freshToken":null}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
result = json.loads(result.content)
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict23")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc列表查询条件验证_商品清单,2295,2295-90,sit,bs
主数据平台:后台运营系统获取客户商品列表接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import json
import random
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, "url87")
request_body = commonFuc().get_business_data(module, "payload87")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
product_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取商品信息
productInfo = result["data"]["list"][product_random]["productCode"]
# 第三步进行列表查询条件验证
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url90")
request_body = commonFuc().get_business_data(module, "payload90", productInfo)
"""
场景: 列表查询条件验证_商品清单
用例名称:列表查询条件验证_商品清单
输出:{"productInfo":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取查询结果中商品信息
result = json.loads(result.content)
result = {"productInfo": result["data"]["list"][0]["productCode"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict90", productInfo)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc列表查询条件验证_商品预测明细,2295,2295-84,sit,bs
主数据平台:后台运营系统获取商品预测明细接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import datetime
import random
import json
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, "url83")
request_body = commonFuc().get_business_data(module, "payload83")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 生成随机数
pr_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取商品信息
startTime = result["data"]["list"][pr_random]["createTime"][:10] + " 00:00:00"
now_time = str(datetime.datetime.now().strftime("%Y-%m-%d")) + " 00:00:00"
productInfo = result["data"]["list"][pr_random]["productCode"]
customerInfo = result["data"]["list"][pr_random]["customerCode"]
procurementDate = result["data"]["list"][pr_random]["procurementDate"]
# 第三步进行列表查询条件验证
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url84")
request_body = commonFuc().get_business_data(module, "payload84", startTime, now_time, productInfo, customerInfo,
startTime, now_time, procurementDate)
# print(request_body)
"""
场景: 列表查询条件验证_商品预测明细
用例名称:列表查询条件验证_商品预测明细
输出:{"productInfo":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# print(result)
# 获取查询结果中商品信息
result = json.loads(result.content)
result = {"productInfo": result["data"]["list"][0]["productCode"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict84", productInfo)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- 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)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc列表查询条件验证_红票明细列表,2295,2295-75,sit,bs
主数据平台:后台运营系统获取红票明细列表接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import datetime
import random
import json
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, "url74")
request_body = commonFuc().get_business_data(module, "payload74")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
red_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取红票明细信息
demandParentCode = result["data"]["list"][red_random]["demandParentCode"]
demandCode = result["data"]["list"][red_random]["demandCode"]
customerName = result["data"]["list"][red_random]["customerName"]
orderStatus = result["data"]["list"][red_random]["orderStatus"]
startTime = result["data"]["list"][red_random]["auditTime"][:10] + " 00:00:00"
endTime = str(datetime.datetime.now().strftime("%Y-%m-%d")) + " 23:59:59"
startTime = ""
endTime = ""
# 第三步进行列表查询条件验证
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url75")
request_body = commonFuc().get_business_data(module, "payload75", demandParentCode, demandCode, customerName,
orderStatus,
startTime, endTime)
# print(request_body)
"""
场景: 列表查询条件验证_红票明细列表
用例名称:列表查询条件验证_红票明细列表
输出:{"demandCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取查询结果中红票明细信息
result = json.loads(result.content)
# print(result)
result = {"demandCode": result["data"]["list"][0]["demandCode"]}
# 将接口响应时间添加至结果中
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict75", demandCode)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc列表查询条件验证_终端流向,2295,2295-61,sit,bs
主数据平台:后台运营系统获取终端流向列表接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import datetime
import random
import json
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, "url60")
request_body = commonFuc().get_business_data(module, "payload60")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
flow_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取终端流向信息
delete_sign = result["data"]["list"][flow_random]["deleteSign"]
flow_id = result["data"]["list"][flow_random]["flowId"]
end_customer_name = result["data"]["list"][flow_random]["endCustomerName"]
invoice_no = result["data"]["list"][flow_random]["invoiceNo"]
manufacturer = result["data"]["list"][flow_random]["manufacturer"]
customer_code = result["data"]["list"][flow_random]["customerCode"]
customer_name = result["data"]["list"][flow_random]["customerName"]
demand_code = result["data"]["list"][flow_random]["demandCode"]
# 第三步获取终端流向详情信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url65")
request_body = commonFuc().get_business_data(module, "payload65", demand_code, invoice_no, delete_sign, flow_id)
# 发送请求
result1 = requests.post(url, json=request_body, headers=headers)
result1 = json.loads(result1.content)
# 获取终端流向详情信息
product_info = (result1["data"][0]["productName"] if result1["data"][0]["productName"] else "")
material_code = (result1["data"][0]["materialCode"] if result1["data"][0]["materialCode"] else "")
order_start_time = result1["data"][0]["orderTime"][:10]
upload_start_time = result1["data"][0]["orderTime"][:10]
product_code = (result1["data"][0]["productCode"] if result1["data"][0]["productCode"] else "")
product_code = ""
now_date = datetime.datetime.now().strftime("%Y-%m-%d")
# 第四步进行列表查询条件验证
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url61")
request_body = commonFuc().get_business_data(module, "payload61", end_customer_name, invoice_no, manufacturer,
product_info,
material_code, order_start_time, customer_code, customer_name,
upload_start_time,
now_date, product_code, demand_code, now_date)
# print(request_body)
# print(material_code)
"""
场景: 列表查询条件验证_终端流向
用例名称:列表查询条件验证_终端流向
输出:{"demandCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取终端流向详情中信息
result = json.loads(result.content)
# print(result)
result = {"demandCode": result["data"]["list"][0]["demandCode"]}
# 将接口响应时间添加至结果中
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict61", demand_code)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc列表查询条件验证_销售任务列表,2295,2295-73,sit,bs
主数据平台:后台运营系统获取销售任务下发列表接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import json
import random
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, "url72")
request_body = commonFuc().get_business_data(module, "payload72")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
task_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取任务下发信息
customerCode = result["data"]["list"][task_random]["customers"][0]["customerCode"]
customerName = result["data"]["list"][task_random]["customers"][0]["customerName"]
materialCode = result["data"]["list"][task_random]["products"][0]["materialCode"]
productCode = result["data"]["list"][task_random]["products"][0]["productCode"]
productLineName = result["data"]["list"][task_random]["products"][0]["productLineName"]
productName = result["data"]["list"][task_random]["products"][0]["productName"]
specifications = result["data"]["list"][task_random]["products"][0]["specifications"]
taskName = result["data"]["list"][task_random]["taskName"]
taskYear = result["data"]["list"][task_random]["taskYear"]
useSign = result["data"]["list"][task_random]["useSign"]
# 第三步进行列表查询条件验证
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url73")
request_body = commonFuc().get_business_data(module, "payload73", customerCode, customerName, materialCode, productCode,
productLineName, productName, specifications, taskName, taskYear, useSign)
"""
场景: 列表查询条件验证_销售任务列表
用例名称:列表查询条件验证_销售任务列表
输出:{"taskName":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 获取查询结果中任务名称
result = json.loads(result.content)
result = {"taskName": result["data"]["list"][0]["taskName"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict73", taskName)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc删除无效草稿订单验证_代客下单,2295,2295-54,sit,bs
主数据平台:后台运营系统草稿订单删除接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import random
import json
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)
# 随机生成无效的订单id
order_id = random.randint(0, 5)
# 第二步进行草稿订单删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url54")
request_body = commonFuc().get_business_data(module, "payload54", order_id)
"""
场景: 删除无效草稿订单验证_代客下单
用例名称:删除无效草稿订单验证_代客下单
输出:{"success":true,"code":"200","message":"OK","data":false,"freshToken":null}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# 将接口响应时间添加至result
result = json.loads(result.content)
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict54")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc刷新jde侧库存接口验证,2295,2295-125,sit,bs
主数据平台:后台运营系刷新jde侧库存接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import json
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)
# 第二步同步SO接口
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url125")
request_body = commonFuc().get_business_data(module, "payload125")
"""
场景: 刷新jde侧库存接口验证
用例名称:刷新jde侧库存接口验证
输出:{"success":true,"code":"200","message":null,"data":null,"freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
result = json.loads(result.content)
# 将接口响应时间添加至result
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict125")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
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