Fix bug with not cleaning UI folder

This commit is contained in:
Matthias 2021-01-31 14:43:16 +01:00
parent 944d674eeb
commit 7b3d99819f
2 changed files with 5 additions and 5 deletions

View File

@ -213,13 +213,12 @@ def start_install_ui(args: Dict[str, Any]) -> None:
curr_version = read_ui_version(dest_folder)
if curr_version == latest_version and not args.get('erase_ui_only'):
logger.info(f"UI already uptodate, FreqUI Version {curr_version}.")
logger.info(f"UI already up-to-date, FreqUI Version {curr_version}.")
return
if args.get('erase_ui_only'):
clean_ui_subdir(dest_folder)
if args.get('erase_ui_only'):
logger.info("Erased UI directory content. Not downloading new version.")
else:
# Download a new version
download_and_install_ui(dest_folder, dl_url, latest_version)

View File

@ -561,7 +561,8 @@ def test_start_new_hyperopt_no_arg(mocker):
def test_start_install_ui(mocker):
clean_mock = mocker.patch('freqtrade.commands.deploy_commands.clean_ui_subdir')
get_url_mock = mocker.patch('freqtrade.commands.deploy_commands.get_ui_download_url')
get_url_mock = mocker.patch('freqtrade.commands.deploy_commands.get_ui_download_url',
return_value=('https://example.com/whatever', '0.0.1'))
download_mock = mocker.patch('freqtrade.commands.deploy_commands.download_and_install_ui')
mocker.patch('freqtrade.commands.deploy_commands.read_ui_version', return_value=None)
args = [
@ -582,7 +583,7 @@ def test_start_install_ui(mocker):
]
start_install_ui(get_args(args))
assert clean_mock.call_count == 1
assert get_url_mock.call_count == 0
assert get_url_mock.call_count == 1
assert download_mock.call_count == 0