mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
additional tests
This commit is contained in:
parent
48e218d6c0
commit
b34aa46181
|
@ -133,7 +133,7 @@ class FreqtradeBot(object):
|
|||
f'*Strategy:* `{strategy_name}`'
|
||||
})
|
||||
if self.config.get('dynamic_whitelist', False):
|
||||
top_pairs = 'top ' + str(self.config.get('dynamic_whitelist', False))
|
||||
top_pairs = 'top ' + str(self.config.get('dynamic_whitelist', 20))
|
||||
specific_pairs = ''
|
||||
else:
|
||||
top_pairs = 'whitelisted'
|
||||
|
|
|
@ -1095,6 +1095,38 @@ def test_send_msg_status_notification(default_conf, mocker) -> None:
|
|||
assert msg_mock.call_args[0][0] == '*Status:* `running`'
|
||||
|
||||
|
||||
def test_warning_notification(default_conf, mocker) -> None:
|
||||
msg_mock = MagicMock()
|
||||
mocker.patch.multiple(
|
||||
'freqtrade.rpc.telegram.Telegram',
|
||||
_init=MagicMock(),
|
||||
_send_msg=msg_mock
|
||||
)
|
||||
freqtradebot = get_patched_freqtradebot(mocker, default_conf)
|
||||
telegram = Telegram(freqtradebot)
|
||||
telegram.send_msg({
|
||||
'type': RPCMessageType.WARNING_NOTIFICATION,
|
||||
'status': 'message'
|
||||
})
|
||||
assert msg_mock.call_args[0][0] == '*Warning:* `message`'
|
||||
|
||||
|
||||
def test_custom_notification(default_conf, mocker) -> None:
|
||||
msg_mock = MagicMock()
|
||||
mocker.patch.multiple(
|
||||
'freqtrade.rpc.telegram.Telegram',
|
||||
_init=MagicMock(),
|
||||
_send_msg=msg_mock
|
||||
)
|
||||
freqtradebot = get_patched_freqtradebot(mocker, default_conf)
|
||||
telegram = Telegram(freqtradebot)
|
||||
telegram.send_msg({
|
||||
'type': RPCMessageType.CUSTOM_NOTIFICATION,
|
||||
'status': '*Custom:* `Hello World`'
|
||||
})
|
||||
assert msg_mock.call_args[0][0] == '*Custom:* `Hello World`'
|
||||
|
||||
|
||||
def test_send_msg_unknown_type(default_conf, mocker) -> None:
|
||||
msg_mock = MagicMock()
|
||||
mocker.patch.multiple(
|
||||
|
|
|
@ -1876,3 +1876,9 @@ def test_get_real_amount_open_trade(default_conf, mocker):
|
|||
freqtrade = FreqtradeBot(default_conf)
|
||||
patch_get_signal(freqtrade)
|
||||
assert freqtrade.get_real_amount(trade, order) == amount
|
||||
|
||||
|
||||
def test_startup_messages(default_conf, mocker):
|
||||
default_conf['dynamic_whitelist'] = 20
|
||||
freqtrade = get_patched_freqtradebot(mocker, default_conf)
|
||||
assert freqtrade.state is State.RUNNING
|
||||
|
|
Loading…
Reference in New Issue
Block a user