From ba0fa1120a6537d1d08af191e19b243556064f29 Mon Sep 17 00:00:00 2001 From: kevinjulian Date: Fri, 23 Jul 2021 18:39:18 +0700 Subject: [PATCH] revert rename naming --- tests/rpc/test_rpc_telegram.py | 26 +++++++++++++------------- tests/test_freqtradebot.py | 34 +++++++++++++++++----------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index ab66d18e8..5aeebb2d7 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -63,12 +63,12 @@ def get_telegram_testobject(mocker, default_conf, mock=True, freqtrade=None): _init=MagicMock(), _send_msg=msg_mock ) - if not freqtrade: - freqtrade = get_patched_freqtradebot(mocker, default_conf) - rpc = RPC(freqtrade) + if not ftbot: + ftbot = get_patched_freqtradebot(mocker, default_conf) + rpc = RPC(ftbot) telegram = Telegram(rpc, default_conf) - return telegram, freqtrade, msg_mock + return telegram, ftbot, msg_mock def test_telegram__init__(default_conf, mocker) -> None: @@ -115,11 +115,11 @@ def test_authorized_only(default_conf, mocker, caplog, update) -> None: patch_exchange(mocker) caplog.set_level(logging.DEBUG) default_conf['telegram']['enabled'] = False - freqtrade = FreqtradeBot(default_conf) - rpc = RPC(freqtrade) + bot = FreqtradeBot(default_conf) + rpc = RPC(bot) dummy = DummyCls(rpc, default_conf) - patch_get_signal(freqtrade, (True, False, None)) + patch_get_signal(bot, (True, False, None)) dummy.dummy_handler(update=update, context=MagicMock()) assert dummy.state['called'] is True assert log_has('Executing handler: dummy_handler for chat_id: 0', caplog) @@ -135,11 +135,11 @@ def test_authorized_only_unauthorized(default_conf, mocker, caplog) -> None: update.message = Message(randint(1, 100), datetime.utcnow(), chat) default_conf['telegram']['enabled'] = False - freqtrade = FreqtradeBot(default_conf) - rpc = RPC(freqtrade) + bot = FreqtradeBot(default_conf) + rpc = RPC(bot) dummy = DummyCls(rpc, default_conf) - patch_get_signal(freqtrade, (True, False, None)) + patch_get_signal(bot, (True, False, None)) dummy.dummy_handler(update=update, context=MagicMock()) assert dummy.state['called'] is False assert not log_has('Executing handler: dummy_handler for chat_id: 3735928559', caplog) @@ -152,10 +152,10 @@ def test_authorized_only_exception(default_conf, mocker, caplog, update) -> None default_conf['telegram']['enabled'] = False - freqtrade = FreqtradeBot(default_conf) - rpc = RPC(freqtrade) + bot = FreqtradeBot(default_conf) + rpc = RPC(bot) dummy = DummyCls(rpc, default_conf) - patch_get_signal(freqtrade, (True, False, None)) + patch_get_signal(bot, (True, False, None)) dummy.dummy_exception(update=update, context=MagicMock()) assert dummy.state['called'] is False diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index abbef7858..b3a5bc409 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -2014,16 +2014,16 @@ def test_close_trade(default_conf, ticker, limit_buy_order, limit_buy_order_open def test_bot_loop_start_called_once(mocker, default_conf, caplog): - freqtrade = get_patched_freqtradebot(mocker, default_conf) + ftbot = get_patched_freqtradebot(mocker, default_conf) mocker.patch('freqtrade.freqtradebot.FreqtradeBot.create_trade') - patch_get_signal(freqtrade) - freqtrade.strategy.bot_loop_start = MagicMock(side_effect=ValueError) - freqtrade.strategy.analyze = MagicMock() + patch_get_signal(ftbot) + ftbot.strategy.bot_loop_start = MagicMock(side_effect=ValueError) + ftbot.strategy.analyze = MagicMock() - freqtrade.process() + ftbot.process() assert log_has_re(r'Strategy caused the following exception.*', caplog) - assert freqtrade.strategy.bot_loop_start.call_count == 1 - assert freqtrade.strategy.analyze.call_count == 1 + assert ftbot.strategy.bot_loop_start.call_count == 1 + assert ftbot.strategy.analyze.call_count == 1 def test_check_handle_timedout_buy_usercustom(default_conf, ticker, limit_buy_order_old, open_trade, @@ -4086,14 +4086,14 @@ def test_startup_trade_reinit(default_conf, edge_conf, mocker): reinit_mock = MagicMock() mocker.patch('freqtrade.persistence.Trade.stoploss_reinitialization', reinit_mock) - freqtrade = get_patched_freqtradebot(mocker, default_conf) - freqtrade.startup() + ftbot = get_patched_freqtradebot(mocker, default_conf) + ftbot.startup() assert reinit_mock.call_count == 1 reinit_mock.reset_mock() - freqtrade = get_patched_freqtradebot(mocker, edge_conf) - freqtrade.startup() + ftbot = get_patched_freqtradebot(mocker, edge_conf) + ftbot.startup() assert reinit_mock.call_count == 0 @@ -4112,17 +4112,17 @@ def test_sync_wallet_dry_run(mocker, default_conf, ticker, fee, limit_buy_order_ get_fee=fee, ) - freqtrade = get_patched_freqtradebot(mocker, default_conf) - patch_get_signal(freqtrade) - assert freqtrade.wallets.get_free('BTC') == 0.002 + bot = get_patched_freqtradebot(mocker, default_conf) + patch_get_signal(bot) + assert bot.wallets.get_free('BTC') == 0.002 - n = freqtrade.enter_positions() + n = bot.enter_positions() assert n == 2 trades = Trade.query.all() assert len(trades) == 2 - freqtrade.config['max_open_trades'] = 3 - n = freqtrade.enter_positions() + bot.config['max_open_trades'] = 3 + n = bot.enter_positions() assert n == 0 assert log_has_re(r"Unable to create trade for XRP/BTC: " r"Available balance \(0.0 BTC\) is lower than stake amount \(0.001 BTC\)",