作者 dengyuting

add所有管理后台接口

name: 分红管理—批量支付分红
base_url: ${ENV(base_manager_url)}
variables:
orderIds:
- '1'
- '2'
- '3'
- '4'
orderIds: ${get_orderids()}
# - '1'
# - '2'
# - '3'
# - '4'
teardown_hooks:
- ${sleep(1)}
request:
... ...
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDAxOTI5MzgsImlhdCI6MTYwMDE0OTczOCwiaXNzIjoibW1tX3BhcnRuZXJtZyIsIm5iZiI6MTYwMDE0OTczOCwidWlkIjozMjQ0MDg0Njk1OTY1NDQwLCJjb21wYW55SWQiOjM1OH0.f_z2yOeoPOuvpUWlleEH4q3AIsMXFGiF9I31LsRarUQ
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDgwNjMzMjYsImlhdCI6MTYwODAyMDEyNiwiaXNzIjoibW1tX3BhcnRuZXJtZyIsIm5iZiI6MTYwODAyMDEyNiwidWlkIjozMjQyMzEyOTU1MTM1NzQ0LCJjb21wYW55SWQiOjIxNH0.5T0V7slgyKzUkFGOIOrF5rSgyMfp9MIqGM9Xjy8svbQ
\ No newline at end of file
... ...
1682,1683,1684,1685,1686,
\ No newline at end of file
... ...
... ... @@ -5,6 +5,7 @@ from urllib import parse
from helpfunc.login_func import *
from helpfunc.pg_db_func import *
from helpfunc.other_func import *
# from helpfunc.db_func import *
from helpfunc.header_func import *
from random import randint
... ...
# @Time :2019/11/26 11:23
# @Author :dengyuting
# @File :login_func.py
import json
##每次执行自动化测试前,清空该文件,该文件用于批量支付时传orderids
def setup_hook_clean_orderid():
try:
with open('config/orderid.csv', 'w') as f:
f.seek(0)
f.truncate()
except Exception as e:
print('清空失败', e)
def teardown_hook_get_orderid(response):
if response.status_code == 200:
jsondata = json.loads(response.text)
orderid =jsondata['data']['id']
try:
# 保存token到文件
with open('config/orderid.csv','a+') as f:
f.write(str(orderid)+',')
print('写入成功,orderid:{}'.format(orderid))
f.close()
except Exception as e:
print('写入失败', e)
return orderid
def get_orderids():
try:
with open('config/orderid.csv','r') as f:
orderids = f.read()
print('读取orderids成功:{}'.format(orderids))
f.close()
except Exception as e:
print('读取失败', e)
orderid = orderids.split(',')
orderid.pop(-1)
return orderid
... ...
config:
name: COM003-新增多条实际订单,具体新增几条请修改times字段
base_url: ${ENV(base_manager_url)}
variables:
partnerID: 1047
commissionProportion: 5
orderNum1: 100
univalence: 15
partnerRatio: 10
orderNum2: 200
# partnerRatio2: 20
# output:
# - actual_id
# - product_id_1
# - product_id_2
teststeps:
- name: $phone 登录系统
variables:
phone: ${ENV(adminphone)}
testcase: testcases/common/m_login_testcases.yml
- name: 新增实发订单
times: 5
api: api/m_api/actual/m_add_order_actual_api.yml
teardown_hooks:
- ${teardown_hook_get_orderid($response)}
validate:
- eq:
- content.msg
- ok
#- name: 查看实际订单列表
# api: api/m_api/actual/m_order_actual_list_api.yml
# extract:
# - actual_id: content.data.gridResult.lists.0.id
# validate:
# - eq:
# - content.data.gridResult.lists.0.id
# - ${convert_to_string($orderid)}
# - eq:
# - content.msg
# - ok
#
#- name: 查看实际订单详情
# variables:
# id: ${convert_to_string($actual_id)}
# api: api/m_api/actual/m_order_actual_detail_api.yml
# extract:
# - product_id_1: content.data.product.0.id
# - product_id_2: content.data.product.1.id
# validate:
# - eq:
# - content.data.orderNumCount
# - ${add($orderNum1,$orderNum2)}
# - eq:
# - content.data.orderAmountAdjustmentCount
# - ${cal_orderPrice($univalence, $orderNum1, $orderNum2)}
# - eq:
# - content.data.product.0.orderPrice
# - ${cal_orderPrice($univalence, $orderNum1)}
# - eq:
# - content.data.product.1.orderPrice
# - ${cal_orderPrice($univalence, $orderNum2)}
\ No newline at end of file
... ...
... ... @@ -3,6 +3,7 @@ config:
#清理数据
setup_hooks:
- ${setup_hook_clean_db(214)}
- ${setup_hook_clean_orderid()}
teardown_hooks:
- ${sleep(2)}
... ...
config:
name: DIV010-分红管理-批量支付分红成功,数据正确
base_url: ${ENV(base_manager_url)}
variables:
partnerID: 1047
commissionProportion: 5
orderNum1: 100
univalence: 15
partnerRatio: 10
orderNum2: 200
# partnerRatio2: 20
# output:
# - actual_id
# - product_id_1
# - product_id_2
teststeps:
- name: $phone 登录系统
variables:
phone: ${ENV(adminphone)}
testcase: testcases/common/m_login_testcases.yml
- name: 新增实发订单
times: 5
api: api/m_api/actual/m_add_order_actual_api.yml
teardown_hooks:
- ${teardown_hook_get_orderid($response)}
validate:
- eq:
- content.msg
- ok
- name: 查看分红列表
api: api/m_api/dividends/m_dividends_list_api.yml
validate:
#####已支付状态=2
- eq:
- content.data.gridResult.lists.0.stateOfPayment
- 1
- eq:
- content.data.gridResult.lists.1.stateOfPayment
- 1
- eq:
- content.data.gridResult.lists.2.stateOfPayment
- 1
- eq:
- content.data.gridResult.lists.3.stateOfPayment
- 1
- eq:
- content.data.gridResult.lists.4.stateOfPayment
- 1
- name: 批量支付分红
api: api/m_api/dividends/m_dividends_payDividends_batch_api.yml
validate:
- eq:
- content.msg
- ok
- name: 查看分红列表
api: api/m_api/dividends/m_dividends_list_api.yml
validate:
#####已支付状态=2
- eq:
- content.data.gridResult.lists.0.stateOfPayment
- 2
- eq:
- content.data.gridResult.lists.1.stateOfPayment
- 2
- eq:
- content.data.gridResult.lists.2.stateOfPayment
- 2
- eq:
- content.data.gridResult.lists.3.stateOfPayment
- 2
- eq:
- content.data.gridResult.lists.4.stateOfPayment
- 2
... ...
... ... @@ -2,7 +2,7 @@ config:
name: 合伙人测试集
testcases:
- name: start....初始化数据库
- name: start....初始化数据库和文件
testcase: testcases/common/start_testcases.yml
############################分红管理模块开始#################################
... ... @@ -38,6 +38,9 @@ testcases:
- name: DIV009-分红管理-自建订单调整分红比例,系统提示‘操作失败’
testcase: testcases/dividends/DIV009_dividends_editnum_testcases.yml
- name: DIV010-分红管理-批量支付分红成功,数据正确
testcase: testcases/dividends/DIV010_dividends_payDividends_batch_testcases.yml
############################分红管理模块结束##################################
- name: ACT001-实际订单-各个值计算正确
... ...