revert rename naming

This commit is contained in:
kevinjulian 2021-07-23 18:39:18 +07:00
parent acfaa39e54
commit ba0fa1120a
2 changed files with 30 additions and 30 deletions

View File

@ -63,12 +63,12 @@ def get_telegram_testobject(mocker, default_conf, mock=True, freqtrade=None):
_init=MagicMock(), _init=MagicMock(),
_send_msg=msg_mock _send_msg=msg_mock
) )
if not freqtrade: if not ftbot:
freqtrade = get_patched_freqtradebot(mocker, default_conf) ftbot = get_patched_freqtradebot(mocker, default_conf)
rpc = RPC(freqtrade) rpc = RPC(ftbot)
telegram = Telegram(rpc, default_conf) telegram = Telegram(rpc, default_conf)
return telegram, freqtrade, msg_mock return telegram, ftbot, msg_mock
def test_telegram__init__(default_conf, mocker) -> None: 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) patch_exchange(mocker)
caplog.set_level(logging.DEBUG) caplog.set_level(logging.DEBUG)
default_conf['telegram']['enabled'] = False default_conf['telegram']['enabled'] = False
freqtrade = FreqtradeBot(default_conf) bot = FreqtradeBot(default_conf)
rpc = RPC(freqtrade) rpc = RPC(bot)
dummy = DummyCls(rpc, default_conf) 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()) dummy.dummy_handler(update=update, context=MagicMock())
assert dummy.state['called'] is True assert dummy.state['called'] is True
assert log_has('Executing handler: dummy_handler for chat_id: 0', caplog) 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) update.message = Message(randint(1, 100), datetime.utcnow(), chat)
default_conf['telegram']['enabled'] = False default_conf['telegram']['enabled'] = False
freqtrade = FreqtradeBot(default_conf) bot = FreqtradeBot(default_conf)
rpc = RPC(freqtrade) rpc = RPC(bot)
dummy = DummyCls(rpc, default_conf) 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()) dummy.dummy_handler(update=update, context=MagicMock())
assert dummy.state['called'] is False assert dummy.state['called'] is False
assert not log_has('Executing handler: dummy_handler for chat_id: 3735928559', caplog) 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 default_conf['telegram']['enabled'] = False
freqtrade = FreqtradeBot(default_conf) bot = FreqtradeBot(default_conf)
rpc = RPC(freqtrade) rpc = RPC(bot)
dummy = DummyCls(rpc, default_conf) 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()) dummy.dummy_exception(update=update, context=MagicMock())
assert dummy.state['called'] is False assert dummy.state['called'] is False

View File

@ -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): 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') mocker.patch('freqtrade.freqtradebot.FreqtradeBot.create_trade')
patch_get_signal(freqtrade) patch_get_signal(ftbot)
freqtrade.strategy.bot_loop_start = MagicMock(side_effect=ValueError) ftbot.strategy.bot_loop_start = MagicMock(side_effect=ValueError)
freqtrade.strategy.analyze = MagicMock() ftbot.strategy.analyze = MagicMock()
freqtrade.process() ftbot.process()
assert log_has_re(r'Strategy caused the following exception.*', caplog) assert log_has_re(r'Strategy caused the following exception.*', caplog)
assert freqtrade.strategy.bot_loop_start.call_count == 1 assert ftbot.strategy.bot_loop_start.call_count == 1
assert freqtrade.strategy.analyze.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, 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() reinit_mock = MagicMock()
mocker.patch('freqtrade.persistence.Trade.stoploss_reinitialization', reinit_mock) mocker.patch('freqtrade.persistence.Trade.stoploss_reinitialization', reinit_mock)
freqtrade = get_patched_freqtradebot(mocker, default_conf) ftbot = get_patched_freqtradebot(mocker, default_conf)
freqtrade.startup() ftbot.startup()
assert reinit_mock.call_count == 1 assert reinit_mock.call_count == 1
reinit_mock.reset_mock() reinit_mock.reset_mock()
freqtrade = get_patched_freqtradebot(mocker, edge_conf) ftbot = get_patched_freqtradebot(mocker, edge_conf)
freqtrade.startup() ftbot.startup()
assert reinit_mock.call_count == 0 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, get_fee=fee,
) )
freqtrade = get_patched_freqtradebot(mocker, default_conf) bot = get_patched_freqtradebot(mocker, default_conf)
patch_get_signal(freqtrade) patch_get_signal(bot)
assert freqtrade.wallets.get_free('BTC') == 0.002 assert bot.wallets.get_free('BTC') == 0.002
n = freqtrade.enter_positions() n = bot.enter_positions()
assert n == 2 assert n == 2
trades = Trade.query.all() trades = Trade.query.all()
assert len(trades) == 2 assert len(trades) == 2
freqtrade.config['max_open_trades'] = 3 bot.config['max_open_trades'] = 3
n = freqtrade.enter_positions() n = bot.enter_positions()
assert n == 0 assert n == 0
assert log_has_re(r"Unable to create trade for XRP/BTC: " 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\)", r"Available balance \(0.0 BTC\) is lower than stake amount \(0.001 BTC\)",