Add test case for get_ui_download_url

This commit is contained in:
Matthias 2021-01-10 14:52:51 +01:00
parent a1a35115ad
commit ddc99553bd

View File

@ -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))