Fix telegram /daily command without arguments
This commit is contained in:
parent
71e46794b4
commit
058d40a72c
@ -305,7 +305,7 @@ class Telegram(RPC):
|
|||||||
stake_cur = self._config['stake_currency']
|
stake_cur = self._config['stake_currency']
|
||||||
fiat_disp_cur = self._config.get('fiat_display_currency', '')
|
fiat_disp_cur = self._config.get('fiat_display_currency', '')
|
||||||
try:
|
try:
|
||||||
timescale = int(context.args[0]) if context.args else 0
|
timescale = int(context.args[0]) if context.args else 7
|
||||||
except (TypeError, ValueError, IndexError):
|
except (TypeError, ValueError, IndexError):
|
||||||
timescale = 7
|
timescale = 7
|
||||||
try:
|
try:
|
||||||
|
@ -337,6 +337,18 @@ def test_daily_handle(default_conf, update, ticker, limit_buy_order, fee,
|
|||||||
assert str(' 1 trade') in msg_mock.call_args_list[0][0][0]
|
assert str(' 1 trade') in msg_mock.call_args_list[0][0][0]
|
||||||
assert str(' 0 trade') in msg_mock.call_args_list[0][0][0]
|
assert str(' 0 trade') in msg_mock.call_args_list[0][0][0]
|
||||||
|
|
||||||
|
# Reset msg_mock
|
||||||
|
msg_mock.reset_mock()
|
||||||
|
context.args = []
|
||||||
|
telegram._daily(update=update, context=context)
|
||||||
|
assert msg_mock.call_count == 1
|
||||||
|
assert 'Daily' in msg_mock.call_args_list[0][0][0]
|
||||||
|
assert str(datetime.utcnow().date()) in msg_mock.call_args_list[0][0][0]
|
||||||
|
assert str(' 0.00006217 BTC') in msg_mock.call_args_list[0][0][0]
|
||||||
|
assert str(' 0.933 USD') in msg_mock.call_args_list[0][0][0]
|
||||||
|
assert str(' 1 trade') in msg_mock.call_args_list[0][0][0]
|
||||||
|
assert str(' 0 trade') in msg_mock.call_args_list[0][0][0]
|
||||||
|
|
||||||
# Reset msg_mock
|
# Reset msg_mock
|
||||||
msg_mock.reset_mock()
|
msg_mock.reset_mock()
|
||||||
freqtradebot.config['max_open_trades'] = 2
|
freqtradebot.config['max_open_trades'] = 2
|
||||||
|
Loading…
Reference in New Issue
Block a user