mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user