作者 dengyuting

add所有管理后台接口

1 name: 分红管理—批量支付分红 1 name: 分红管理—批量支付分红
2 base_url: ${ENV(base_manager_url)} 2 base_url: ${ENV(base_manager_url)}
3 variables: 3 variables:
4 - orderIds:  
5 - - '1'  
6 - - '2'  
7 - - '3'  
8 - - '4' 4 + orderIds: ${get_orderids()}
  5 +# - '1'
  6 +# - '2'
  7 +# - '3'
  8 +# - '4'
9 teardown_hooks: 9 teardown_hooks:
10 - ${sleep(1)} 10 - ${sleep(1)}
11 request: 11 request:
1 -eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDAxOTI5MzgsImlhdCI6MTYwMDE0OTczOCwiaXNzIjoibW1tX3BhcnRuZXJtZyIsIm5iZiI6MTYwMDE0OTczOCwidWlkIjozMjQ0MDg0Njk1OTY1NDQwLCJjb21wYW55SWQiOjM1OH0.f_z2yOeoPOuvpUWlleEH4q3AIsMXFGiF9I31LsRarUQ 1 +eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDgwNjMzMjYsImlhdCI6MTYwODAyMDEyNiwiaXNzIjoibW1tX3BhcnRuZXJtZyIsIm5iZiI6MTYwODAyMDEyNiwidWlkIjozMjQyMzEyOTU1MTM1NzQ0LCJjb21wYW55SWQiOjIxNH0.5T0V7slgyKzUkFGOIOrF5rSgyMfp9MIqGM9Xjy8svbQ
  1 +1682,1683,1684,1685,1686,
@@ -5,6 +5,7 @@ from urllib import parse @@ -5,6 +5,7 @@ from urllib import parse
5 5
6 from helpfunc.login_func import * 6 from helpfunc.login_func import *
7 from helpfunc.pg_db_func import * 7 from helpfunc.pg_db_func import *
  8 +from helpfunc.other_func import *
8 # from helpfunc.db_func import * 9 # from helpfunc.db_func import *
9 from helpfunc.header_func import * 10 from helpfunc.header_func import *
10 from random import randint 11 from random import randint
  1 +# @Time :2019/11/26 11:23
  2 +# @Author :dengyuting
  3 +# @File :login_func.py
  4 +import json
  5 +
  6 +
  7 +##每次执行自动化测试前,清空该文件,该文件用于批量支付时传orderids
  8 +def setup_hook_clean_orderid():
  9 + try:
  10 + with open('config/orderid.csv', 'w') as f:
  11 + f.seek(0)
  12 + f.truncate()
  13 + except Exception as e:
  14 + print('清空失败', e)
  15 +
  16 +
  17 +def teardown_hook_get_orderid(response):
  18 + if response.status_code == 200:
  19 + jsondata = json.loads(response.text)
  20 + orderid =jsondata['data']['id']
  21 + try:
  22 + # 保存token到文件
  23 + with open('config/orderid.csv','a+') as f:
  24 + f.write(str(orderid)+',')
  25 + print('写入成功,orderid:{}'.format(orderid))
  26 + f.close()
  27 + except Exception as e:
  28 + print('写入失败', e)
  29 + return orderid
  30 +
  31 +
  32 +def get_orderids():
  33 + try:
  34 + with open('config/orderid.csv','r') as f:
  35 + orderids = f.read()
  36 + print('读取orderids成功:{}'.format(orderids))
  37 + f.close()
  38 + except Exception as e:
  39 + print('读取失败', e)
  40 + orderid = orderids.split(',')
  41 + orderid.pop(-1)
  42 + return orderid
  1 +config:
  2 + name: COM003-新增多条实际订单,具体新增几条请修改times字段
  3 + base_url: ${ENV(base_manager_url)}
  4 + variables:
  5 + partnerID: 1047
  6 + commissionProportion: 5
  7 + orderNum1: 100
  8 + univalence: 15
  9 + partnerRatio: 10
  10 + orderNum2: 200
  11 +# partnerRatio2: 20
  12 +# output:
  13 +# - actual_id
  14 +# - product_id_1
  15 +# - product_id_2
  16 +
  17 +
  18 +teststeps:
  19 +- name: $phone 登录系统
  20 + variables:
  21 + phone: ${ENV(adminphone)}
  22 + testcase: testcases/common/m_login_testcases.yml
  23 +
  24 +- name: 新增实发订单
  25 + times: 5
  26 + api: api/m_api/actual/m_add_order_actual_api.yml
  27 + teardown_hooks:
  28 + - ${teardown_hook_get_orderid($response)}
  29 + validate:
  30 + - eq:
  31 + - content.msg
  32 + - ok
  33 +
  34 +#- name: 查看实际订单列表
  35 +# api: api/m_api/actual/m_order_actual_list_api.yml
  36 +# extract:
  37 +# - actual_id: content.data.gridResult.lists.0.id
  38 +# validate:
  39 +# - eq:
  40 +# - content.data.gridResult.lists.0.id
  41 +# - ${convert_to_string($orderid)}
  42 +# - eq:
  43 +# - content.msg
  44 +# - ok
  45 +#
  46 +#- name: 查看实际订单详情
  47 +# variables:
  48 +# id: ${convert_to_string($actual_id)}
  49 +# api: api/m_api/actual/m_order_actual_detail_api.yml
  50 +# extract:
  51 +# - product_id_1: content.data.product.0.id
  52 +# - product_id_2: content.data.product.1.id
  53 +# validate:
  54 +# - eq:
  55 +# - content.data.orderNumCount
  56 +# - ${add($orderNum1,$orderNum2)}
  57 +# - eq:
  58 +# - content.data.orderAmountAdjustmentCount
  59 +# - ${cal_orderPrice($univalence, $orderNum1, $orderNum2)}
  60 +# - eq:
  61 +# - content.data.product.0.orderPrice
  62 +# - ${cal_orderPrice($univalence, $orderNum1)}
  63 +# - eq:
  64 +# - content.data.product.1.orderPrice
  65 +# - ${cal_orderPrice($univalence, $orderNum2)}
@@ -3,6 +3,7 @@ config: @@ -3,6 +3,7 @@ config:
3 #清理数据 3 #清理数据
4 setup_hooks: 4 setup_hooks:
5 - ${setup_hook_clean_db(214)} 5 - ${setup_hook_clean_db(214)}
  6 + - ${setup_hook_clean_orderid()}
6 teardown_hooks: 7 teardown_hooks:
7 - ${sleep(2)} 8 - ${sleep(2)}
8 9
  1 +config:
  2 + name: DIV010-分红管理-批量支付分红成功,数据正确
  3 + base_url: ${ENV(base_manager_url)}
  4 + variables:
  5 + partnerID: 1047
  6 + commissionProportion: 5
  7 + orderNum1: 100
  8 + univalence: 15
  9 + partnerRatio: 10
  10 + orderNum2: 200
  11 +# partnerRatio2: 20
  12 +# output:
  13 +# - actual_id
  14 +# - product_id_1
  15 +# - product_id_2
  16 +
  17 +
  18 +teststeps:
  19 +- name: $phone 登录系统
  20 + variables:
  21 + phone: ${ENV(adminphone)}
  22 + testcase: testcases/common/m_login_testcases.yml
  23 +
  24 +- name: 新增实发订单
  25 + times: 5
  26 + api: api/m_api/actual/m_add_order_actual_api.yml
  27 + teardown_hooks:
  28 + - ${teardown_hook_get_orderid($response)}
  29 + validate:
  30 + - eq:
  31 + - content.msg
  32 + - ok
  33 +
  34 +- name: 查看分红列表
  35 + api: api/m_api/dividends/m_dividends_list_api.yml
  36 + validate:
  37 + #####已支付状态=2
  38 + - eq:
  39 + - content.data.gridResult.lists.0.stateOfPayment
  40 + - 1
  41 + - eq:
  42 + - content.data.gridResult.lists.1.stateOfPayment
  43 + - 1
  44 + - eq:
  45 + - content.data.gridResult.lists.2.stateOfPayment
  46 + - 1
  47 + - eq:
  48 + - content.data.gridResult.lists.3.stateOfPayment
  49 + - 1
  50 + - eq:
  51 + - content.data.gridResult.lists.4.stateOfPayment
  52 + - 1
  53 +
  54 +- name: 批量支付分红
  55 + api: api/m_api/dividends/m_dividends_payDividends_batch_api.yml
  56 + validate:
  57 + - eq:
  58 + - content.msg
  59 + - ok
  60 +
  61 +- name: 查看分红列表
  62 + api: api/m_api/dividends/m_dividends_list_api.yml
  63 + validate:
  64 + #####已支付状态=2
  65 + - eq:
  66 + - content.data.gridResult.lists.0.stateOfPayment
  67 + - 2
  68 + - eq:
  69 + - content.data.gridResult.lists.1.stateOfPayment
  70 + - 2
  71 + - eq:
  72 + - content.data.gridResult.lists.2.stateOfPayment
  73 + - 2
  74 + - eq:
  75 + - content.data.gridResult.lists.3.stateOfPayment
  76 + - 2
  77 + - eq:
  78 + - content.data.gridResult.lists.4.stateOfPayment
  79 + - 2
  80 +
@@ -2,7 +2,7 @@ config: @@ -2,7 +2,7 @@ config:
2 name: 合伙人测试集 2 name: 合伙人测试集
3 testcases: 3 testcases:
4 4
5 -- name: start....初始化数据库 5 +- name: start....初始化数据库和文件
6 testcase: testcases/common/start_testcases.yml 6 testcase: testcases/common/start_testcases.yml
7 7
8 ############################分红管理模块开始################################# 8 ############################分红管理模块开始#################################
@@ -38,6 +38,9 @@ testcases: @@ -38,6 +38,9 @@ testcases:
38 38
39 - name: DIV009-分红管理-自建订单调整分红比例,系统提示‘操作失败’ 39 - name: DIV009-分红管理-自建订单调整分红比例,系统提示‘操作失败’
40 testcase: testcases/dividends/DIV009_dividends_editnum_testcases.yml 40 testcase: testcases/dividends/DIV009_dividends_editnum_testcases.yml
  41 +
  42 +- name: DIV010-分红管理-批量支付分红成功,数据正确
  43 + testcase: testcases/dividends/DIV010_dividends_payDividends_batch_testcases.yml
41 ############################分红管理模块结束################################## 44 ############################分红管理模块结束##################################
42 45
43 - name: ACT001-实际订单-各个值计算正确 46 - name: ACT001-实际订单-各个值计算正确