Improve test coverage of deploy_commands

This commit is contained in:
Matthias 2020-10-29 07:44:03 +01:00
parent 19fcbc92a7
commit f4d39f2a12
2 changed files with 13 additions and 1 deletions

View File

@ -133,7 +133,7 @@ def start_new_hyperopt(args: Dict[str, Any]) -> None:
if new_path.exists(): if new_path.exists():
raise OperationalException(f"`{new_path}` already exists. " raise OperationalException(f"`{new_path}` already exists. "
"Please choose another Strategy Name.") "Please choose another Hyperopt Name.")
deploy_new_hyperopt(args['hyperopt'], new_path, args['template']) deploy_new_hyperopt(args['hyperopt'], new_path, args['template'])
else: else:
raise OperationalException("`new-hyperopt` requires --hyperopt to be set.") raise OperationalException("`new-hyperopt` requires --hyperopt to be set.")

View File

@ -476,6 +476,12 @@ def test_start_new_strategy(mocker, caplog):
assert "CoolNewStrategy" in wt_mock.call_args_list[0][0][0] assert "CoolNewStrategy" in wt_mock.call_args_list[0][0][0]
assert log_has_re("Writing strategy to .*", caplog) assert log_has_re("Writing strategy to .*", caplog)
mocker.patch('freqtrade.commands.deploy_commands.setup_utils_configuration')
mocker.patch.object(Path, "exists", MagicMock(return_value=True))
with pytest.raises(OperationalException,
match=r".* already exists. Please choose another Strategy Name\."):
start_new_strategy(get_args(args))
def test_start_new_strategy_DefaultStrat(mocker, caplog): def test_start_new_strategy_DefaultStrat(mocker, caplog):
args = [ args = [
@ -512,6 +518,12 @@ def test_start_new_hyperopt(mocker, caplog):
assert "CoolNewhyperopt" in wt_mock.call_args_list[0][0][0] assert "CoolNewhyperopt" in wt_mock.call_args_list[0][0][0]
assert log_has_re("Writing hyperopt to .*", caplog) assert log_has_re("Writing hyperopt to .*", caplog)
mocker.patch('freqtrade.commands.deploy_commands.setup_utils_configuration')
mocker.patch.object(Path, "exists", MagicMock(return_value=True))
with pytest.raises(OperationalException,
match=r".* already exists. Please choose another Hyperopt Name\."):
start_new_hyperopt(get_args(args))
def test_start_new_hyperopt_DefaultHyperopt(mocker, caplog): def test_start_new_hyperopt_DefaultHyperopt(mocker, caplog):
args = [ args = [