parent
652e0d45a9
commit
36361d623d
11 changed files with 54 additions and 48 deletions
|
@ -280,3 +280,14 @@ class TestUtil(unittest.TestCase):
|
|||
mock_random.SystemRandom.return_value = generator
|
||||
|
||||
assert util.get_random_string(length=3) == 'ABC'
|
||||
|
||||
|
||||
async def test_throttle_async():
|
||||
"""Test Throttle decorator with async method."""
|
||||
@util.Throttle(timedelta(seconds=2))
|
||||
async def test_method():
|
||||
"""Only first call should return a value."""
|
||||
return True
|
||||
|
||||
assert (await test_method()) is True
|
||||
assert (await test_method()) is None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue