From 585b8332ad61098fe95bce3e674c559363377dc3 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 26 Nov 2019 11:48:01 +0100 Subject: [PATCH] Improve tests and unify required attribute --- freqtrade/constants.py | 4 +--- tests/test_configuration.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/freqtrade/constants.py b/freqtrade/constants.py index f6e08bc36..0d52bf405 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -269,10 +269,8 @@ CONF_SCHEMA = { 'required': ['process_throttle_secs', 'allowed_risk', 'capital_available_percentage'] } }, - 'anyOf': [ - {'required': ['exchange']} - ], 'required': [ + 'exchange', 'max_open_trades', 'stake_currency', 'stake_amount', diff --git a/tests/test_configuration.py b/tests/test_configuration.py index e50ba99ee..60bd6d7df 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -40,10 +40,16 @@ def test_load_config_invalid_pair(default_conf) -> None: def test_load_config_missing_attributes(default_conf) -> None: - default_conf.pop('exchange') + conf = deepcopy(default_conf) + conf.pop('exchange') with pytest.raises(ValidationError, match=r".*'exchange' is a required property.*"): - validate_config_schema(default_conf) + validate_config_schema(conf) + + conf = deepcopy(default_conf) + conf.pop('stake_currency') + with pytest.raises(ValidationError, match=r".*'stake_currency' is a required property.*"): + validate_config_schema(conf) def test_load_config_incorrect_stake_amount(default_conf) -> None: