Don't modify original config
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
|
from copy import deepcopy
|
||||||
|
|
||||||
from freqtrade.constants import Config
|
from freqtrade.constants import Config
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ def sanitize_config(config: Config, *, show_sensitive: bool = False) -> Config:
|
|||||||
"discord.webhook_url",
|
"discord.webhook_url",
|
||||||
"api_server.password",
|
"api_server.password",
|
||||||
]
|
]
|
||||||
|
config = deepcopy(config)
|
||||||
for key in keys_to_remove:
|
for key in keys_to_remove:
|
||||||
if '.' in key:
|
if '.' in key:
|
||||||
nested_keys = key.split('.')
|
nested_keys = key.split('.')
|
||||||
|
|||||||
@@ -1510,7 +1510,10 @@ def test_setup_freqai_backtesting(mocker, default_conf) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def test_sanitize_config(default_conf_usdt):
|
def test_sanitize_config(default_conf_usdt):
|
||||||
|
assert default_conf_usdt['exchange']['key'] != 'REDACTED'
|
||||||
res = sanitize_config(default_conf_usdt)
|
res = sanitize_config(default_conf_usdt)
|
||||||
|
# Didn't modify original dict
|
||||||
|
assert default_conf_usdt['exchange']['key'] != 'REDACTED'
|
||||||
|
|
||||||
assert res['exchange']['key'] == 'REDACTED'
|
assert res['exchange']['key'] == 'REDACTED'
|
||||||
assert res['exchange']['secret'] == 'REDACTED'
|
assert res['exchange']['secret'] == 'REDACTED'
|
||||||
|
|||||||
Reference in New Issue
Block a user