Eliminate unnecessary lazy import
This commit is contained in:
@@ -90,13 +90,17 @@ def test_ask_user_overwrite(mocker):
|
||||
"""
|
||||
Once https://github.com/tmbo/questionary/issues/35 is implemented, improve this test.
|
||||
"""
|
||||
prompt_mock = mocker.patch("questionary.prompt", return_value={"overwrite": False})
|
||||
prompt_mock = mocker.patch(
|
||||
"freqtrade.commands.build_config_commands.prompt", return_value={"overwrite": False}
|
||||
)
|
||||
assert not ask_user_overwrite(Path("test.json"))
|
||||
assert prompt_mock.call_count == 1
|
||||
|
||||
prompt_mock.reset_mock()
|
||||
|
||||
prompt_mock = mocker.patch("questionary.prompt", return_value={"overwrite": True})
|
||||
prompt_mock = mocker.patch(
|
||||
"freqtrade.commands.build_config_commands.prompt", return_value={"overwrite": False}
|
||||
)
|
||||
assert ask_user_overwrite(Path("test.json"))
|
||||
assert prompt_mock.call_count == 1
|
||||
|
||||
@@ -105,12 +109,16 @@ def test_ask_user_config(mocker):
|
||||
"""
|
||||
Once https://github.com/tmbo/questionary/issues/35 is implemented, improve this test.
|
||||
"""
|
||||
prompt_mock = mocker.patch("questionary.prompt", return_value={"overwrite": False})
|
||||
prompt_mock = mocker.patch(
|
||||
"freqtrade.commands.build_config_commands.prompt", return_value={"overwrite": False}
|
||||
)
|
||||
answers = ask_user_config()
|
||||
assert isinstance(answers, dict)
|
||||
assert prompt_mock.call_count == 1
|
||||
|
||||
prompt_mock = mocker.patch("questionary.prompt", return_value={})
|
||||
prompt_mock = mocker.patch(
|
||||
"freqtrade.commands.build_config_commands.prompt", return_value={"overwrite": False}
|
||||
)
|
||||
|
||||
with pytest.raises(OperationalException, match=r"User interrupted interactive questions\."):
|
||||
ask_user_config()
|
||||
|
||||
@@ -693,7 +693,9 @@ def test_get_ui_download_url(mocker):
|
||||
[{"browser_download_url": "http://download.zip"}],
|
||||
]
|
||||
)
|
||||
get_mock = mocker.patch("requests.get", return_value=response)
|
||||
get_mock = mocker.patch(
|
||||
"freqtrade.commands.deploy_commands.requests.get", return_value=response
|
||||
)
|
||||
x, last_version = get_ui_download_url()
|
||||
assert get_mock.call_count == 2
|
||||
assert last_version == "0.0.1"
|
||||
@@ -716,7 +718,9 @@ def test_get_ui_download_url_direct(mocker):
|
||||
},
|
||||
]
|
||||
)
|
||||
get_mock = mocker.patch("requests.get", return_value=response)
|
||||
get_mock = mocker.patch(
|
||||
"freqtrade.commands.deploy_commands.requests.get", return_value=response
|
||||
)
|
||||
x, last_version = get_ui_download_url()
|
||||
assert get_mock.call_count == 1
|
||||
assert last_version == "0.0.2"
|
||||
|
||||
Reference in New Issue
Block a user