diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 5b452627b..cd1a988d2 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -1417,7 +1417,7 @@ def test_api_pair_history(botclient, ohlcv_history): "No data for UNITTEST/BTC, 5m in 20200111-20200112 found.") -def test_api_plot_config(botclient): +def test_api_plot_config(botclient, mocker): ftbot, client = botclient rc = client_get(client, f"{BASE_URI}/plot_config") @@ -1441,6 +1441,21 @@ def test_api_plot_config(botclient): assert isinstance(rc.json()['main_plot'], dict) assert isinstance(rc.json()['subplots'], dict) + rc = client_get(client, f"{BASE_URI}/plot_config?strategy=freqai_test_classifier") + assert_response(rc) + res = rc.json() + assert 'target_roi' in res['subplots'] + assert 'do_predict' in res['subplots'] + + rc = client_get(client, f"{BASE_URI}/plot_config?strategy=HyperoptableStrategy") + assert_response(rc) + assert rc.json()['subplots'] == {} + + mocker.patch('freqtrade.rpc.api_server.api_v1.get_rpc_optional', return_value=None) + + rc = client_get(client, f"{BASE_URI}/plot_config") + assert_response(rc) + def test_api_strategies(botclient, tmpdir): ftbot, client = botclient diff --git a/tests/strategy/strats/hyperoptable_strategy.py b/tests/strategy/strats/hyperoptable_strategy.py index 9850a5675..eadbc533f 100644 --- a/tests/strategy/strats/hyperoptable_strategy.py +++ b/tests/strategy/strats/hyperoptable_strategy.py @@ -34,6 +34,11 @@ class HyperoptableStrategy(StrategyTestV3): protection_enabled = BooleanParameter(default=True) protection_cooldown_lookback = IntParameter([0, 50], default=30) + # Invalid plot config ... + plot_config = { + "main_plot": {}, + } + @property def protections(self): prot = []