From 57a4044eb0a74209c206941ff9ceb3b763bcf713 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 29 Nov 2020 11:37:10 +0100 Subject: [PATCH] Enhance test verifying that locks are not replaced --- tests/plugins/test_protections.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/plugins/test_protections.py b/tests/plugins/test_protections.py index 22fe33e19..e997c5526 100644 --- a/tests/plugins/test_protections.py +++ b/tests/plugins/test_protections.py @@ -1,5 +1,5 @@ import random -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone import pytest @@ -123,6 +123,12 @@ def test_stoploss_guard(mocker, default_conf, fee, caplog): assert log_has_re(message, caplog) assert PairLocks.is_global_lock() + # Test 5m after lock-period - this should try and relock the pair, but end-time + # should be the previous end-time + end_time = PairLocks.get_pair_longest_lock('*').lock_end_time + timedelta(minutes=5) + assert freqtrade.protections.global_stop(end_time) + assert not PairLocks.is_global_lock(end_time) + @pytest.mark.parametrize('only_per_pair', [False, True]) @pytest.mark.usefixtures("init_persistence")