From d2589c4415830fd94294b0f90bdb47f26fa22d86 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 6 Oct 2019 10:32:19 +0200 Subject: [PATCH] Make test exchange-independent --- tests/test_utils.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index 6168706a2..103a25d6d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -49,8 +49,16 @@ def test_list_exchanges(capsys): assert re.search(r"^bittrex$", captured.out, re.MULTILINE) -def test_list_timeframes(capsys): +def test_list_timeframes(mocker, capsys): + api_mock = MagicMock() + api_mock.timeframes = {'1m': '1m', + '5m': '5m', + '30m': '30m', + '1h': '1h', + '1d': '1d', + } + patch_exchange(mocker, api_mock=api_mock) args = [ "list-timeframes", ] @@ -82,6 +90,17 @@ def test_list_timeframes(capsys): "1m, 5m, 30m, 1h, 1d", captured.out) + api_mock.timeframes = {'1m': '1m', + '5m': '5m', + '15m': '15m', + '30m': '30m', + '1h': '1h', + '6h': '6h', + '12h': '12h', + '1d': '1d', + '3d': '3d', + } + patch_exchange(mocker, api_mock=api_mock) # Test with --exchange binance args = [ "list-timeframes", @@ -90,7 +109,7 @@ def test_list_timeframes(capsys): start_list_timeframes(get_args(args)) captured = capsys.readouterr() assert re.match("Timeframes available for the exchange `binance`: " - "1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M", + "1m, 5m, 15m, 30m, 1h, 6h, 12h, 1d, 3d", captured.out) # Test with --one-column