From 89274bfcdb55de4a0a8ebbd7458e5985c2290adb Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 15 Nov 2025 15:46:09 +0100 Subject: [PATCH] test: update tests for new timeframe approach --- tests/commands/test_commands.py | 2 ++ tests/exchange/test_exchange.py | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index 036352acf..9d71ad448 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -198,6 +198,8 @@ def test_list_timeframes(mocker, capsys): "1h": "hour", "1d": "day", } + api_mock.options = {} + patch_exchange(mocker, api_mock=api_mock, exchange="bybit") args = [ "list-timeframes", diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index a55fa51bf..634034a37 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -742,10 +742,11 @@ def test_get_pair_base_currency(default_conf, mocker, pair, expected): def test_validate_timeframes(default_conf, mocker, timeframe): default_conf["timeframe"] = timeframe api_mock = MagicMock() - id_mock = PropertyMock(return_value="test_exchange") - type(api_mock).id = id_mock - timeframes = PropertyMock(return_value={"1m": "1m", "5m": "5m", "15m": "15m", "1h": "1h"}) - type(api_mock).timeframes = timeframes + id_mock = MagicMock(return_value="test_exchange") + api_mock.id = id_mock + api_mock.options = {} + timeframes = {"1m": "1m", "5m": "5m", "15m": "15m", "1h": "1h"} + api_mock.timeframes = timeframes mocker.patch(f"{EXMS}._init_ccxt", MagicMock(return_value=api_mock)) mocker.patch(f"{EXMS}.reload_markets") @@ -757,12 +758,11 @@ def test_validate_timeframes(default_conf, mocker, timeframe): def test_validate_timeframes_failed(default_conf, mocker): default_conf["timeframe"] = "3m" api_mock = MagicMock() - id_mock = PropertyMock(return_value="test_exchange") - type(api_mock).id = id_mock - timeframes = PropertyMock( - return_value={"15s": "15s", "1m": "1m", "5m": "5m", "15m": "15m", "1h": "1h"} - ) - type(api_mock).timeframes = timeframes + id_mock = MagicMock(return_value="test_exchange") + api_mock.id = id_mock + timeframes = {"15s": "15s", "1m": "1m", "5m": "5m", "15m": "15m", "1h": "1h"} + api_mock.timeframes = timeframes + api_mock.options = {} mocker.patch(f"{EXMS}._init_ccxt", MagicMock(return_value=api_mock)) mocker.patch(f"{EXMS}.reload_markets")