From a88464de3a5ffb4c6802040c6463d4079c5dc868 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 31 Dec 2019 07:01:58 +0100 Subject: [PATCH] Improve some test code --- tests/rpc/test_rpc_telegram.py | 10 ---------- tests/test_freqtradebot.py | 3 ++- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index 44e51514e..9a39f2119 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -148,11 +148,6 @@ def test_status(default_conf, update, mocker, fee, ticker,) -> None: default_conf['telegram']['enabled'] = False default_conf['telegram']['chat_id'] = "123" - mocker.patch.multiple( - 'freqtrade.exchange.Exchange', - fetch_ticker=ticker, - get_fee=fee, - ) msg_mock = MagicMock() status_table = MagicMock() mocker.patch.multiple( @@ -184,13 +179,8 @@ def test_status(default_conf, update, mocker, fee, ticker,) -> None: ) freqtradebot = get_patched_freqtradebot(mocker, default_conf) - patch_get_signal(freqtradebot, (True, False)) telegram = Telegram(freqtradebot) - # Create some test data - n = freqtradebot.enter_positions() - assert n == 1 - telegram._status(update=update, context=MagicMock()) assert msg_mock.call_count == 1 diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index f99b14286..434633f5f 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -1458,12 +1458,13 @@ def test_enter_positions(mocker, default_conf, caplog) -> None: def test_enter_positions_exception(mocker, default_conf, caplog) -> None: freqtrade = get_patched_freqtradebot(mocker, default_conf) - mocker.patch( + mock_ct = mocker.patch( 'freqtrade.freqtradebot.FreqtradeBot.create_trade', MagicMock(side_effect=DependencyException) ) n = freqtrade.enter_positions() assert n == 0 + assert mock_ct.call_count == len(default_conf['exchange']['pair_whitelist']) assert log_has('Unable to create trade: ', caplog)