Improve some test code
This commit is contained in:
parent
fd7af587da
commit
a88464de3a
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user