From c1c20e4d8a97fc3441e7f4145ecceb044cada024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=AE=AE=E0=AE=A9=E0=AF=8B=E0=AE=9C=E0=AF=8D=E0=AE=95?= =?UTF-8?q?=E0=AF=81=E0=AE=AE=E0=AE=BE=E0=AE=B0=E0=AF=8D=20=E0=AE=AA?= =?UTF-8?q?=E0=AE=B4=E0=AE=A9=E0=AE=BF=E0=AE=9A=E0=AF=8D=E0=AE=9A=E0=AE=BE?= =?UTF-8?q?=E0=AE=AE=E0=AE=BF?= Date: Wed, 30 Mar 2022 18:31:40 +0530 Subject: [PATCH] corrected tests --- freqtrade/rpc/telegram.py | 10 +++++----- tests/rpc/test_rpc.py | 3 ++- tests/test_freqtradebot.py | 5 +++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index ae840ed6d..bcaccba2c 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -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 = ( diff --git a/tests/rpc/test_rpc.py b/tests/rpc/test_rpc.py index 9ac811c1f..7d926b23a 100644 --- a/tests/rpc/test_rpc.py +++ b/tests/rpc/test_rpc.py @@ -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') diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 4ef57afb1..b0abdaebb 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -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]