From ddc99553bd422c250f1d9beba59fccd90211b999 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 10 Jan 2021 14:52:51 +0100 Subject: [PATCH] Add test case for get_ui_download_url --- tests/commands/test_commands.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index a39044c18..ba45f1618 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -13,7 +13,7 @@ from freqtrade.commands import (start_convert_data, start_create_userdir, start_ start_list_markets, start_list_strategies, start_list_timeframes, start_new_hyperopt, start_new_strategy, start_show_trades, start_test_pairlist, start_trading) -from freqtrade.commands.deploy_commands import clean_ui_subdir, download_and_install_ui +from freqtrade.commands.deploy_commands import clean_ui_subdir, download_and_install_ui, get_ui_download_url from freqtrade.configuration import setup_utils_configuration from freqtrade.exceptions import OperationalException from freqtrade.state import RunMode @@ -588,7 +588,7 @@ def test_clean_ui_subdir(mocker, tmpdir, caplog): assert ul_mock.call_count == 1 -def test_download_and_install_ui(mocker, tmpdir, caplog): +def test_download_and_install_ui(mocker, tmpdir): # Create zipfile requests_mock = MagicMock() file_like_object = BytesIO() @@ -612,6 +612,18 @@ def test_download_and_install_ui(mocker, tmpdir, caplog): assert wb_mock.call_count == 2 +def test_get_ui_download_url(mocker): + response = MagicMock() + response.json = MagicMock( + side_effect=[[{'assets_url': 'http://whatever.json'}], + [{'browser_download_url': 'http://download.zip'}]]) + get_mock = mocker.patch("freqtrade.commands.deploy_commands.requests.get", + return_value=response) + x = get_ui_download_url() + assert get_mock.call_count == 2 + assert x == 'http://download.zip' + + def test_download_data_keyboardInterrupt(mocker, caplog, markets): dl_mock = mocker.patch('freqtrade.commands.data_commands.refresh_backtest_ohlcv_data', MagicMock(side_effect=KeyboardInterrupt))