tests: update tests to ues new module

This commit is contained in:
Matthias
2025-06-20 20:19:38 +02:00
parent 5e059660d4
commit 2165c3e542
2 changed files with 20 additions and 17 deletions

View File

@@ -35,7 +35,6 @@ from freqtrade.exchange.common import (
API_FETCH_ORDER_RETRY_COUNT, API_FETCH_ORDER_RETRY_COUNT,
API_RETRY_COUNT, API_RETRY_COUNT,
calculate_backoff, calculate_backoff,
remove_exchange_credentials,
) )
from freqtrade.resolvers.exchange_resolver import ExchangeResolver from freqtrade.resolvers.exchange_resolver import ExchangeResolver
from freqtrade.util import dt_now, dt_ts from freqtrade.util import dt_now, dt_ts
@@ -167,20 +166,6 @@ def test_init(default_conf, mocker, caplog):
assert log_has("Instance is running with dry_run enabled", caplog) assert log_has("Instance is running with dry_run enabled", caplog)
def test_remove_exchange_credentials(default_conf) -> None:
conf = deepcopy(default_conf)
remove_exchange_credentials(conf["exchange"], False)
assert conf["exchange"]["key"] != ""
assert conf["exchange"]["secret"] != ""
remove_exchange_credentials(conf["exchange"], True)
assert conf["exchange"]["key"] == ""
assert conf["exchange"]["secret"] == ""
assert conf["exchange"]["password"] == ""
assert conf["exchange"]["uid"] == ""
def test_init_ccxt_kwargs(default_conf, mocker, caplog): def test_init_ccxt_kwargs(default_conf, mocker, caplog):
mocker.patch(f"{EXMS}.reload_markets") mocker.patch(f"{EXMS}.reload_markets")
mocker.patch(f"{EXMS}.validate_stakecurrency") mocker.patch(f"{EXMS}.validate_stakecurrency")

View File

@@ -9,8 +9,12 @@ import pytest
from jsonschema import ValidationError from jsonschema import ValidationError
from freqtrade.commands import Arguments from freqtrade.commands import Arguments
from freqtrade.configuration import Configuration, validate_config_consistency from freqtrade.configuration import (
from freqtrade.configuration.config_secrets import sanitize_config Configuration,
remove_exchange_credentials,
sanitize_config,
validate_config_consistency,
)
from freqtrade.configuration.config_validation import validate_config_schema from freqtrade.configuration.config_validation import validate_config_schema
from freqtrade.configuration.deprecated_settings import ( from freqtrade.configuration.deprecated_settings import (
check_conflicting_settings, check_conflicting_settings,
@@ -1587,3 +1591,17 @@ def test_sanitize_config(default_conf_usdt):
res = sanitize_config(default_conf_usdt, show_sensitive=True) res = sanitize_config(default_conf_usdt, show_sensitive=True)
assert res["exchange"]["key"] == default_conf_usdt["exchange"]["key"] assert res["exchange"]["key"] == default_conf_usdt["exchange"]["key"]
assert res["exchange"]["secret"] == default_conf_usdt["exchange"]["secret"] assert res["exchange"]["secret"] == default_conf_usdt["exchange"]["secret"]
def test_remove_exchange_credentials(default_conf) -> None:
conf = deepcopy(default_conf)
remove_exchange_credentials(conf["exchange"], False)
assert conf["exchange"]["key"] != ""
assert conf["exchange"]["secret"] != ""
remove_exchange_credentials(conf["exchange"], True)
assert conf["exchange"]["key"] == ""
assert conf["exchange"]["secret"] == ""
assert conf["exchange"]["password"] == ""
assert conf["exchange"]["uid"] == ""