mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +00:00
Add explicit test for config sanitization
This commit is contained in:
@@ -10,6 +10,7 @@ from jsonschema import ValidationError
|
||||
|
||||
from freqtrade.commands import Arguments
|
||||
from freqtrade.configuration import Configuration, validate_config_consistency
|
||||
from freqtrade.configuration.config_secrets import sanitize_config
|
||||
from freqtrade.configuration.config_validation import validate_config_schema
|
||||
from freqtrade.configuration.deprecated_settings import (check_conflicting_settings,
|
||||
process_deprecated_setting,
|
||||
@@ -1426,7 +1427,7 @@ def test_flat_vars_to_nested_dict(caplog):
|
||||
assert not log_has("Loading variable 'NOT_RELEVANT'", caplog)
|
||||
|
||||
|
||||
def test_setup_hyperopt_freqai(mocker, default_conf, caplog) -> None:
|
||||
def test_setup_hyperopt_freqai(mocker, default_conf) -> None:
|
||||
patched_configuration_load_config_file(mocker, default_conf)
|
||||
mocker.patch(
|
||||
'freqtrade.configuration.configuration.create_datadir',
|
||||
@@ -1459,7 +1460,7 @@ def test_setup_hyperopt_freqai(mocker, default_conf, caplog) -> None:
|
||||
validate_config_consistency(config)
|
||||
|
||||
|
||||
def test_setup_freqai_backtesting(mocker, default_conf, caplog) -> None:
|
||||
def test_setup_freqai_backtesting(mocker, default_conf) -> None:
|
||||
patched_configuration_load_config_file(mocker, default_conf)
|
||||
mocker.patch(
|
||||
'freqtrade.configuration.configuration.create_datadir',
|
||||
@@ -1506,3 +1507,14 @@ def test_setup_freqai_backtesting(mocker, default_conf, caplog) -> None:
|
||||
OperationalException, match=r".* pass --timerange if you intend to use FreqAI .*"
|
||||
):
|
||||
validate_config_consistency(conf)
|
||||
|
||||
|
||||
def test_sanitize_config(default_conf_usdt):
|
||||
res = sanitize_config(default_conf_usdt)
|
||||
|
||||
assert res['exchange']['key'] == 'REDACTED'
|
||||
assert res['exchange']['secret'] == 'REDACTED'
|
||||
|
||||
res = sanitize_config(default_conf_usdt, show_sensitive=True)
|
||||
assert res['exchange']['key'] == default_conf_usdt['exchange']['key']
|
||||
assert res['exchange']['secret'] == default_conf_usdt['exchange']['secret']
|
||||
|
||||
Reference in New Issue
Block a user