Browse Source

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
merge-requests/157/head
Andrew Shu 6 months ago
parent
commit
ff2e6dd452
  1. 2
      tildes/tests/test_ratelimit.py

2
tildes/tests/test_ratelimit.py

@ -4,6 +4,7 @@
from datetime import timedelta from datetime import timedelta
from itertools import permutations from itertools import permutations
from random import randint from random import randint
from time import sleep
from pytest import raises from pytest import raises
@ -153,6 +154,7 @@ def test_time_until_retry(redis):
# first usage should be fine # first usage should be fine
result = action.check_for_user_id(user_id) result = action.check_for_user_id(user_id)
assert result.is_allowed assert result.is_allowed
sleep(1.0)
# second should fail, and require a wait of (period / limit) - 1 sec # second should fail, and require a wait of (period / limit) - 1 sec
result = action.check_for_user_id(user_id) result = action.check_for_user_id(user_id)

Loading…
Cancel
Save