作者 dengyuting

调整

... ... @@ -4,11 +4,11 @@ variables:
partnerID: 1047
commissionProportion: 5
orderNum1: 100
univalence1: 15
partnerRatio1: 10
univalence: 10
partnerRatio: 10
orderNum2: 200
univalence2: 15
partnerRatio2: 20
# univalence2: 15
# partnerRatio2: 20
teardown_hooks:
- ${sleep(2)}
request:
... ... @@ -26,12 +26,12 @@ request:
product:
- productName: 产品名称${get_stringcode(5)}
orderNum: $orderNum1
univalence: $univalence1
partnerRatio: $partnerRatio1
univalence: $univalence
partnerRatio: $partnerRatio
- productName: 产品名称${get_stringcode(5)}
orderNum: $orderNum2
univalence: $univalence2
partnerRatio: $partnerRatio2
univalence: $univalence
partnerRatio: $partnerRatio
method: POST
url: /v1/order/actual/update
validate:
... ...
... ... @@ -5,11 +5,10 @@ variables:
partnerID: 1047
commissionProportion: 5
orderNum1: 100
univalence1: 15
partnerRatio1: 10
univalence: 15
partnerRatio: 10
orderNum2: 200
univalence2: 15
partnerRatio2: 20
# partnerRatio2: 20
teardown_hooks:
- ${sleep(2)}
request:
... ... @@ -26,12 +25,12 @@ request:
product:
- productName: 产品名称${get_stringcode(5)}
orderNum: $orderNum1
univalence: $univalence1
partnerRatio: $partnerRatio1
univalence: $univalence
partnerRatio: $partnerRatio
- productName: 产品名称${get_stringcode(5)}
orderNum: $orderNum2
univalence: $univalence2
partnerRatio: $partnerRatio2
univalence: $univalence
partnerRatio: $partnerRatio
# - productName: 产品名称${get_second()}
# orderNum: 3
# univalence: 3.22
... ...
... ... @@ -11,45 +11,57 @@ from random import randint
# from helpfunc.pg_app_db_func import *
from datetime import date, timedelta
import datetime
from helpfunc.cal_func import *
def sleep(n_secs):
time.sleep(n_secs)
def convert_to_string(value):
return str(value)
def get_nowtime():
return time.strftime("%Y%m%d%H%M%S",time.localtime(time.time()))
def get_today():
now_today = datetime.datetime.now()
str_time = now_today.strftime("%Y-%m-%d")
return str_time
def get_tomorrow():
tomorrow = (date.today() + timedelta(days=1)).strftime("%Y-%m-%d")
return tomorrow
def get_second():
curr_time = datetime.datetime.now()
return curr_time.second
def create_channel(num):
channel = []
for i in range(num+1):
channel.append(i)
return channel
def get_minute():
i = datetime.datetime.now()
return i.minute
def create_phone_number(num):
phone_number = []
for i in range(num):
number = random.randint(0,9)
phone_number.append('1%d%d%07d'%(get_minute(),number+1,number))
return phone_number
def getMonth():
year = str(datetime.date.today().year)
d = datetime.date.today()
... ... @@ -76,14 +88,20 @@ def getMonth():
list = [startTime, endTime]
return list
list_time = getMonth()
def get_starTimestamp():
return int(time.mktime(time.strptime(list_time[0], '%Y-%m-%d %H:%M:%S'))*1000)
def get_endTimestamp():
return int(time.mktime(time.strptime(list_time[1], '%Y-%m-%d %H:%M:%S'))*1000)
def get_January_timestamp():
return int(time.mktime(time.strptime('2020-04-01 00:00:00', '%Y-%m-%d %H:%M:%S'))*1000)
def get_Decembe_timestamp():
return int(time.mktime(time.strptime('2021-3-31 23:59:59', '%Y-%m-%d %H:%M:%S'))*1000)
... ... @@ -110,16 +128,6 @@ def get_randint(value1, value2):
return randint(value1, value2)
def add(x, y):
"""
对两个数相加
:param x:
:param y:
:return:
"""
return int(int(x)+y)
def convert_to_string(value):
return str(value)
... ...
# @Time :2020/10/22 9:43
# @Author :dengyuting
# @File :cal_func.py
# 计算产品总价
def cal_orderPrice(univalence, *args):
sum = 0
for num in args:
sum = sum + univalence * num
return sum
def cal_Ratio(ratio, univalence, *args):
price = cal_orderPrice(univalence, *args)
sum = ratio/100 * price
return sum
def add(x, y):
"""
对两个数相加
:param x:
:param y:
:return:
"""
return int(int(x)+y)
\ No newline at end of file
... ...
... ... @@ -18,6 +18,23 @@ def teardown_hook_get_accesstoken(response):
print('写入失败', e)
return access_token
def teardown_hook_get_m_accesstoken(response):
print(response.status_code)
if response.status_code == 200:
jsondata = json.loads(response.text)
access_token = jsondata['data']['access']['accessToken']
try:
# 保存token到文件
with open('config/m_accessToken.csv','w+') as f:
f.write(access_token)
print('写入成功,access_token:{}'.format(access_token))
f.close()
except Exception as e:
print('写入失败', e)
return access_token
def teardown_hook_get_refreshtoken(response):
if response.status_code == 200:
jsondata = json.loads(response.text)
... ... @@ -32,6 +49,7 @@ def teardown_hook_get_refreshtoken(response):
print('写入失败', e)
return refresh_token
def teardown_hook_get_m_refreshtoken(response):
if response.status_code == 200:
jsondata = json.loads(response.text)
... ... @@ -46,6 +64,7 @@ def teardown_hook_get_m_refreshtoken(response):
print('写入失败', e)
return m_refresh_token
def teardown_hook_get_authcode(response):
if response.status_code == 200:
jsondata = json.loads(response.text)
... ... @@ -60,20 +79,6 @@ def teardown_hook_get_authcode(response):
print('写入失败', e)
return authCode
def teardown_hook_get_m_accesstoken(response):
print(response.status_code)
if response.status_code == 200:
jsondata = json.loads(response.text)
access_token = jsondata['data']['access']['accessToken']
try:
# 保存token到文件
with open('config/m_accessToken.csv','w+') as f:
f.write(access_token)
print('写入成功,access_token:{}'.format(access_token))
f.close()
except Exception as e:
print('写入失败', e)
return access_token
def get_accesstoken():
try:
... ... @@ -86,6 +91,7 @@ def get_accesstoken():
accseetoken_value = str(accseetoken_value)
return accseetoken_value
def get_m_accesstoken():
try:
with open('config/m_accessToken.csv','r') as f:
... ... @@ -98,6 +104,7 @@ def get_m_accesstoken():
authorization = 'bearer ' + accseetoken_value
return authorization
def get_m_refreshtoken():
try:
with open('config/m_refresh_token.csv','r') as f:
... ... @@ -110,6 +117,7 @@ def get_m_refreshtoken():
authorization = 'bear ' + m_refreshtoken_value
return authorization
def get_refreshtoken():
try:
with open('config/refreshToken.csv','r') as f:
... ... @@ -121,6 +129,7 @@ def get_refreshtoken():
refreshtoken_value = str(refreshtoken_value)
return refreshtoken_value
def get_authcode():
try:
with open('config/authCode.csv','r') as f:
... ...
... ... @@ -5,11 +5,10 @@ config:
partnerID: 1047
commissionProportion: 5
orderNum1: 100
univalence1: 15
partnerRatio1: 10
univalence: 15
partnerRatio: 10
orderNum2: 200
univalence2: 15
partnerRatio2: 20
# partnerRatio2: 20
output:
- actual_id
- product_id_1
... ... @@ -54,10 +53,10 @@ teststeps:
- ${add($orderNum1,$orderNum2)}
- eq:
- content.data.orderAmountAdjustmentCount
- 4500
- ${cal_orderPrice($univalence, $orderNum1, $orderNum2)}
- eq:
- content.data.product.0.orderPrice
- 1500
- ${cal_orderPrice($univalence, $orderNum1)}
- eq:
- content.data.product.1.orderPrice
- 3000
\ No newline at end of file
- ${cal_orderPrice($univalence, $orderNum2)}
\ No newline at end of file
... ...
config:
name: DIV003-事业分红详情-初始状态-各个值计算正确
base_url: ${ENV(base_manager_url)}
variables:
partnerID: 1047
commissionProportion: 5
orderNum1: 100
univalence: 15
partnerRatio: 10
orderNum2: 200
# partnerRatio2: 20
teststeps:
- name: 新增实际订单
... ... @@ -19,35 +27,35 @@ teststeps:
#####总数量
- eq:
- content.data.dividendCount.orderNum
- 300
- ${add($orderNum1,$orderNum2)}
#####总金额
- eq:
- content.data.dividendCount.orderAmountAdjustment
- 4500
- ${cal_orderPrice($univalence, $orderNum1, $orderNum2)}
####业务员抽成
- eq:
- content.data.dividendCount.expectedCommission
- 225
- ${cal_Ratio($commissionProportion, $univalence, $orderNum1, $orderNum2)}
#####合伙人应收分红总额
- eq:
- content.data.dividendCount.partnerDividends
- 750
- ${cal_Ratio($partnerRatio, $univalence, $orderNum1, $orderNum2)}
#####合伙人未收分红总额
- eq:
- content.data.dividendCount.notReceivedDividend
- 750
- ${cal_Ratio($partnerRatio, $univalence, $orderNum1, $orderNum2)}
#####产品1总金额
- eq:
- content.data.product.0.detail.orderPrice
- 1500
- ${cal_orderPrice($univalence, $orderNum1)}
#####产品1应收分红
- eq:
- content.data.product.0.detail.partnerDividendsReceivable
- 150
- ${cal_Ratio($partnerRatio, $univalence, $orderNum1)}
#####产品1未收分红
- eq:
- content.data.product.0.notReceivedDividend
- 150
- ${cal_Ratio($partnerRatio, $univalence, $orderNum1)}
#####产品1分红状态
- eq:
- content.data.product.0.stateOfPayment
... ... @@ -55,15 +63,15 @@ teststeps:
#####产品2总金额
- eq:
- content.data.product.1.detail.orderPrice
- 3000
- ${cal_orderPrice($univalence, $orderNum2)}
#####产品2应收分红
- eq:
- content.data.product.1.detail.partnerDividendsReceivable
- 600
- ${cal_Ratio($partnerRatio, $univalence, $orderNum2)}
#####产品2未收分红
- eq:
- content.data.product.1.notReceivedDividend
- 600
- ${cal_Ratio($partnerRatio, $univalence, $orderNum2)}
#####产品2分红状态
- eq:
- content.data.product.1.stateOfPayment
... ...
... ... @@ -35,7 +35,7 @@ teststeps:
######应收分红
- eq:
- content.data.gridResult.lists.0.dividendsReceivable
- ${convert_to_string(675)}
- ${convert_to_string(375)}
#####已收分红
- eq:
- content.data.gridResult.lists.0.receiveDividends
... ... @@ -43,7 +43,7 @@ teststeps:
#####未收分红
- eq:
- content.data.gridResult.lists.0.uncollectedDividends
- ${convert_to_string(675)}
- ${convert_to_string(375)}
- name: 查看该订单的事业分红详情
... ... @@ -77,15 +77,15 @@ teststeps:
#####合伙人应收分红总额
- eq:
- content.data.dividendCount.partnerDividends
- 750
- 450
#####合伙人应收分红总额调整
- eq:
- content.data.dividendCount.partnerDividendsControl
- ${convert_to_string(675)}
- ${convert_to_string(375)}
#####合伙人未收分红总额
- eq:
- content.data.dividendCount.notReceivedDividend
- 675
- 375
#####合伙人已收分红总额
- eq:
- content.data.dividendCount.receivedDividends
... ... @@ -129,11 +129,11 @@ teststeps:
#####产品2应收分红
- eq:
- content.data.product.1.detail.partnerDividendsReceivable
- 600
- 300
#####产品2未收分红
- eq:
- content.data.product.1.notReceivedDividend
- 600
- 300
#####产品2分红状态
- eq:
- content.data.product.1.stateOfPayment
... ...
... ... @@ -33,13 +33,13 @@ teststeps:
- 2
- eq:
- content.data.gridResult.lists.0.dividendsReceivable
- ${convert_to_string(675)}
- ${convert_to_string(375)}
- eq:
- content.data.gridResult.lists.0.receiveDividends
- ${convert_to_string(75)}
- eq:
- content.data.gridResult.lists.0.uncollectedDividends
- ${convert_to_string(600)}
- ${convert_to_string(300)}
- name: 查看该订单的事业分红详情
... ... @@ -73,15 +73,15 @@ teststeps:
#####合伙人应收分红总额
- eq:
- content.data.dividendCount.partnerDividends
- 750
- 450
#####合伙人应收分红总额调整
- eq:
- content.data.dividendCount.partnerDividendsControl
- ${convert_to_string(675)}
- ${convert_to_string(375)}
#####合伙人未收分红总额
- eq:
- content.data.dividendCount.notReceivedDividend
- 600
- 300
#####合伙人已收分红总额
- eq:
- content.data.dividendCount.receivedDividends
... ... @@ -125,11 +125,11 @@ teststeps:
#####产品2应收分红
- eq:
- content.data.product.1.detail.partnerDividendsReceivable
- 600
- 300
#####产品2未收分红
- eq:
- content.data.product.1.notReceivedDividend
- 600
- 300
#####产品2分红状态
- eq:
- content.data.product.1.stateOfPayment
... ...
... ... @@ -46,7 +46,7 @@ teststeps:
####应收分红
- eq:
- content.data.gridResult.lists.0.dividendsReceivable
- ${convert_to_string(690)}
- ${convert_to_string(390)}
####已收分红
- eq:
- content.data.gridResult.lists.0.receiveDividends
... ... @@ -54,7 +54,7 @@ teststeps:
####未收分红
- eq:
- content.data.gridResult.lists.0.uncollectedDividends
- ${convert_to_string(600)}
- ${convert_to_string(300)}
####分红支出
- eq:
- content.data.gridResult.lists.0.dividendSpending
... ... @@ -92,15 +92,15 @@ teststeps:
#####合伙人应收分红总额
- eq:
- content.data.dividendCount.partnerDividends
- 750
- 450
#####合伙人应收分红总额调整
- eq:
- content.data.dividendCount.partnerDividendsControl
- ${convert_to_string(690)}
- ${convert_to_string(390)}
#####合伙人未收分红总额
- eq:
- content.data.dividendCount.notReceivedDividend
- 600
- 300
#####合伙人已收分红总额
- eq:
- content.data.dividendCount.receivedDividends
... ... @@ -156,11 +156,11 @@ teststeps:
#####产品2应收分红
- eq:
- content.data.product.1.detail.partnerDividendsReceivable
- 600
- 300
#####产品2未收分红
- eq:
- content.data.product.1.notReceivedDividend
- 600
- 300
#####产品2分红状态
- eq:
- content.data.product.1.stateOfPayment
... ...
... ... @@ -5,11 +5,11 @@ config:
partnerID: 1047
commissionProportion: 5
orderNum1: 100
univalence1: 15
partnerRatio1: 10
univalence: 15
partnerRatio: 10
orderNum2: 200
univalence2: 15
partnerRatio2: 20
# univalence2: 15
# partnerRatio2: 20
teststeps:
- name: $phone 登录系统
... ...
... ... @@ -6,11 +6,11 @@ config:
partnerID: 1047
commissionProportion: 5
orderNum1: 100
univalence1: 15
partnerRatio1: 10
univalence: 15
partnerRatio: 10
orderNum2: 200
univalence2: 15
partnerRatio2: 20
# univalence2: 15
# partnerRatio2: 20
teststeps:
- name: $phone 登录系统
... ...