mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-03-02 16:21:20 +00:00
test: improve api-strategy test
This commit is contained in:
@@ -2559,13 +2559,27 @@ def test_api_strategy(botclient, tmp_path, mocker):
|
|||||||
rc = client_get(client, f"{BASE_URI}/strategy/{CURRENT_TEST_STRATEGY}")
|
rc = client_get(client, f"{BASE_URI}/strategy/{CURRENT_TEST_STRATEGY}")
|
||||||
|
|
||||||
assert_response(rc)
|
assert_response(rc)
|
||||||
assert rc.json()["strategy"] == CURRENT_TEST_STRATEGY
|
response = rc.json()
|
||||||
|
assert response["strategy"] == CURRENT_TEST_STRATEGY
|
||||||
|
|
||||||
data = (Path(__file__).parents[1] / "strategy/strats/strategy_test_v3.py").read_text(
|
data = (Path(__file__).parents[1] / "strategy/strats/strategy_test_v3.py").read_text(
|
||||||
encoding="utf-8"
|
encoding="utf-8"
|
||||||
)
|
)
|
||||||
assert rc.json()["code"] == data
|
assert response["code"] == data
|
||||||
|
assert "params" in response
|
||||||
|
assert isinstance(response["params"], list)
|
||||||
|
assert len(response["params"]) == 6
|
||||||
|
buy_rsi = next(p for p in response["params"] if p["name"] == "buy_rsi")
|
||||||
|
assert buy_rsi == {
|
||||||
|
"param_type": "IntParameter",
|
||||||
|
"name": "buy_rsi",
|
||||||
|
"space": "buy",
|
||||||
|
"load": True,
|
||||||
|
"optimize": True,
|
||||||
|
"value": 35, # Parameter from buy_params
|
||||||
|
"low": 0,
|
||||||
|
"high": 50,
|
||||||
|
}
|
||||||
rc = client_get(client, f"{BASE_URI}/strategy/NoStrat")
|
rc = client_get(client, f"{BASE_URI}/strategy/NoStrat")
|
||||||
assert_response(rc, 404)
|
assert_response(rc, 404)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user