From ff2e6dd45261f652621f3d108913cc77fc76a8b7 Mon Sep 17 00:00:00 2001 From: Andrew Shu Date: Tue, 12 Nov 2024 23:18:04 -0800 Subject: [PATCH] test: fix ratelimit test the rate limiting logic slightly changed from redis-cell v0.2.2: https://github.com/brandur/redis-cell/releases/tag/v0.2.2 --- tildes/tests/test_ratelimit.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tildes/tests/test_ratelimit.py b/tildes/tests/test_ratelimit.py index a606032..51b2b9c 100644 --- a/tildes/tests/test_ratelimit.py +++ b/tildes/tests/test_ratelimit.py @@ -4,6 +4,7 @@ from datetime import timedelta from itertools import permutations from random import randint +from time import sleep from pytest import raises @@ -153,6 +154,7 @@ def test_time_until_retry(redis): # first usage should be fine result = action.check_for_user_id(user_id) assert result.is_allowed + sleep(1.0) # second should fail, and require a wait of (period / limit) - 1 sec result = action.check_for_user_id(user_id)