Fix some formatting errors, add test for strategy version
This commit is contained in:
parent
d4fd13bf50
commit
2080bf0952
@ -1305,10 +1305,11 @@ class Telegram(RPCHandler):
|
|||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
strategy_version = self._rpc._freqtrade.strategy.version()
|
strategy_version = self._rpc._freqtrade.strategy.version()
|
||||||
if strategy_version is None:
|
version_string = f'*Version:* `{__version__}`'
|
||||||
self._send_msg('*Version:* `{}`'.format(__version__))
|
if strategy_version is not None:
|
||||||
else:
|
version_string += f', *Strategy version: * `{strategy_version}`'
|
||||||
self._send_msg('*Freqtrade version:* `{}`, *Strategy version:* `{}`'.format(__version__, strategy_version))
|
|
||||||
|
self._send_msg(version_string)
|
||||||
|
|
||||||
@authorized_only
|
@authorized_only
|
||||||
def _show_config(self, update: Update, context: CallbackContext) -> None:
|
def _show_config(self, update: Update, context: CallbackContext) -> None:
|
||||||
|
@ -115,7 +115,7 @@ class Worker:
|
|||||||
if (now - self._heartbeat_msg) > self._heartbeat_interval:
|
if (now - self._heartbeat_msg) > self._heartbeat_interval:
|
||||||
version = __version__
|
version = __version__
|
||||||
strategy_version = self.freqtrade.strategy.version()
|
strategy_version = self.freqtrade.strategy.version()
|
||||||
if (strategy_version != None):
|
if (strategy_version is not None):
|
||||||
version += ', strategy_version: ' + strategy_version
|
version += ', strategy_version: ' + strategy_version
|
||||||
logger.info(f"Bot heartbeat. PID={getpid()}, "
|
logger.info(f"Bot heartbeat. PID={getpid()}, "
|
||||||
f"version='{version}', state='{state.name}'")
|
f"version='{version}', state='{state.name}'")
|
||||||
|
@ -1559,12 +1559,20 @@ def test_help_handle(default_conf, update, mocker) -> None:
|
|||||||
|
|
||||||
def test_version_handle(default_conf, update, mocker) -> None:
|
def test_version_handle(default_conf, update, mocker) -> None:
|
||||||
|
|
||||||
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
|
telegram, freqtradebot, msg_mock = get_telegram_testobject(mocker, default_conf)
|
||||||
|
|
||||||
telegram._version(update=update, context=MagicMock())
|
telegram._version(update=update, context=MagicMock())
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert '*Version:* `{}`'.format(__version__) in msg_mock.call_args_list[0][0][0]
|
assert '*Version:* `{}`'.format(__version__) in msg_mock.call_args_list[0][0][0]
|
||||||
|
|
||||||
|
msg_mock.reset_mock()
|
||||||
|
freqtradebot.strategy.version = lambda: '1.1.1'
|
||||||
|
|
||||||
|
telegram._version(update=update, context=MagicMock())
|
||||||
|
assert msg_mock.call_count == 1
|
||||||
|
assert '*Version:* `{}`'.format(__version__) in msg_mock.call_args_list[0][0][0]
|
||||||
|
assert '*Strategy version: * `1.1.1`' in msg_mock.call_args_list[0][0][0]
|
||||||
|
|
||||||
|
|
||||||
def test_show_config_handle(default_conf, update, mocker) -> None:
|
def test_show_config_handle(default_conf, update, mocker) -> None:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user