corrected tests

This commit is contained in:
மனோஜ்குமார் பழனிச்சாமி 2022-03-30 18:31:40 +05:30
parent bd00f6de17
commit c1c20e4d8a
3 changed files with 10 additions and 8 deletions

View File

@ -229,7 +229,7 @@ class Telegram(RPCHandler):
message = (
f"{emoji} *{msg['exchange']}:* {'Bought' if is_fill else 'Buying'} {msg['pair']}"
f" (#{msg['trade_id']})\n"
)
)
message += f"*Buy Tag:* `{msg['buy_tag']}`\n" if msg.get('buy_tag', None) else ""
message += f"*Amount:* `{msg['amount']:.8f}`\n"
@ -283,8 +283,8 @@ class Telegram(RPCHandler):
else:
msg['profit_extra'] = ''
msg['profit_extra'] = (
f" ({msg['gain']}: {msg['profit_amount']:.8f} {msg['stake_currency']}"
f"{msg['profit_extra']})")
f" ({msg['gain']}: {msg['profit_amount']:.8f} {msg['stake_currency']}"
f"{msg['profit_extra']})")
is_fill = msg['type'] == RPCMessageType.SELL_FILL
is_sub_trade = msg.get('sub_trade')
is_sub_profit = msg['profit_amount'] != msg.get('cumulative_profit')
@ -297,8 +297,8 @@ class Telegram(RPCHandler):
cp_extra = f" / {cp_fiat:.3f} {msg['fiat_currency']}"
else:
cp_extra = ''
cp_extra = f"*Cumulative Profit:* (`{msg['cumulative_profit']:.8f}" \
f" {msg['stake_currency']}{cp_extra}`)\n"
cp_extra = f"*Cumulative Profit:* (`{msg['cumulative_profit']:.8f} " \
f"{msg['stake_currency']}{cp_extra}`)\n"
else:
cp_extra = ''
message = (

View File

@ -823,7 +823,8 @@ def test_rpc_forcesell(default_conf, ticker, fee, mocker) -> None:
'side': 'sell',
'amount': amount,
'remaining': amount,
'filled': 0.0
'filled': 0.0,
'id': trade.orders[0].order_id
}
)
msg = rpc._rpc_forcesell('3')

View File

@ -2617,7 +2617,8 @@ def test_handle_cancel_exit_limit(mocker, default_conf_usdt, fee) -> None:
close_date=arrow.utcnow().datetime,
sell_reason="sell_reason_whatever",
)
order = {'remaining': 1,
order = {'id': "123456",
'remaining': 1,
'amount': 1,
'status': "open"}
reason = CANCEL_REASON['TIMEOUT']
@ -4963,7 +4964,7 @@ def test_position_adjust3(mocker, default_conf_usdt, fee, data) -> None:
trade = Trade.query.first()
assert trade
if idx < len(orders) - 1:
if idx < len(data) - 1:
assert trade.is_open is True
assert trade.open_order_id is None
assert trade.amount == result[0]