Add tests for plotconfig in ws mode
This commit is contained in:
parent
2298656e45
commit
634b80f0e7
@ -1417,7 +1417,7 @@ def test_api_pair_history(botclient, ohlcv_history):
|
|||||||
"No data for UNITTEST/BTC, 5m in 20200111-20200112 found.")
|
"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
|
ftbot, client = botclient
|
||||||
|
|
||||||
rc = client_get(client, f"{BASE_URI}/plot_config")
|
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()['main_plot'], dict)
|
||||||
assert isinstance(rc.json()['subplots'], 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):
|
def test_api_strategies(botclient, tmpdir):
|
||||||
ftbot, client = botclient
|
ftbot, client = botclient
|
||||||
|
@ -34,6 +34,11 @@ class HyperoptableStrategy(StrategyTestV3):
|
|||||||
protection_enabled = BooleanParameter(default=True)
|
protection_enabled = BooleanParameter(default=True)
|
||||||
protection_cooldown_lookback = IntParameter([0, 50], default=30)
|
protection_cooldown_lookback = IntParameter([0, 50], default=30)
|
||||||
|
|
||||||
|
# Invalid plot config ...
|
||||||
|
plot_config = {
|
||||||
|
"main_plot": {},
|
||||||
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def protections(self):
|
def protections(self):
|
||||||
prot = []
|
prot = []
|
||||||
|
Loading…
Reference in New Issue
Block a user