Merge pull request #6294 from xataxxx/health

/health api and telegram commands to return last processing time
This commit is contained in:
Matthias
2022-02-02 19:53:45 +01:00
committed by GitHub
8 changed files with 66 additions and 8 deletions

View File

@@ -1276,3 +1276,13 @@ def test_rpc_edge_enabled(mocker, edge_conf) -> None:
assert ret[0]['Winrate'] == 0.66
assert ret[0]['Expectancy'] == 1.71
assert ret[0]['Stoploss'] == -0.02
def test_rpc_health(mocker, default_conf) -> None:
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
freqtradebot = get_patched_freqtradebot(mocker, default_conf)
rpc = RPC(freqtradebot)
result = rpc._health()
assert result['last_process'] == '1970-01-01 00:00:00+00:00'
assert result['last_process_ts'] == 0

View File

@@ -1442,3 +1442,14 @@ def test_api_backtesting(botclient, mocker, fee, caplog, tmpdir):
assert result['status'] == 'reset'
assert not result['running']
assert result['status_msg'] == 'Backtest reset'
def test_health(botclient):
ftbot, client = botclient
rc = client_get(client, f"{BASE_URI}/health")
assert_response(rc)
ret = rc.json()
assert ret['last_process_ts'] == 0
assert ret['last_process'] == '1970-01-01T00:00:00+00:00'

View File

@@ -99,7 +99,7 @@ def test_telegram_init(default_conf, mocker, caplog) -> None:
"['count'], ['locks'], ['unlock', 'delete_locks'], "
"['reload_config', 'reload_conf'], ['show_config', 'show_conf'], "
"['stopbuy'], ['whitelist'], ['blacklist'], ['blacklist_delete', 'bl_delete'], "
"['logs'], ['edge'], ['help'], ['version']"
"['logs'], ['edge'], ['health'], ['help'], ['version']"
"]")
assert log_has(message_str, caplog)