Improve tests

This commit is contained in:
Matthias 2020-11-25 10:58:50 +01:00
parent 32cde1cb7d
commit dcdf4a0503
1 changed files with 14 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import pytest
from freqtrade.persistence import PairLocks, Trade
from freqtrade.strategy.interface import SellType
from freqtrade import constants
from tests.conftest import get_patched_freqtradebot, log_has_re
@ -35,6 +36,19 @@ def generate_mock_trade(pair: str, fee: float, is_open: bool,
return trade
def test_protectionmanager(mocker, default_conf):
default_conf['protections'] = [{'method': protection}
for protection in constants.AVAILABLE_PROTECTIONS]
freqtrade = get_patched_freqtradebot(mocker, default_conf)
for handler in freqtrade.protections._protection_handlers:
assert handler.name in constants.AVAILABLE_PROTECTIONS
if not handler.has_global_stop:
assert handler.global_stop(datetime.utcnow()) == (False, None, None)
if not handler.has_local_stop:
assert handler.local_stop('XRP/BTC', datetime.utcnow()) == (False, None, None)
@pytest.mark.usefixtures("init_persistence")
def test_stoploss_guard(mocker, default_conf, fee, caplog):
default_conf['protections'] = [{
@ -176,7 +190,6 @@ def test_LowProfitPairs(mocker, default_conf, fee, caplog):
assert not PairLocks.is_global_lock()
@pytest.mark.parametrize("protectionconf,desc_expected,exception_expected", [
({"method": "StoplossGuard", "lookback_period": 60, "trade_limit": 2},
"[{'StoplossGuard': 'StoplossGuard - Frequent Stoploss Guard, "