Make Throttle async aware (#13027)

* Make Throttle async aware

* Lint
This commit is contained in:
Paulus Schoutsen committed 2018-03-09 19:42:35 -08:00
1 parent 8f807a3006
commit 6ffc53b290
11 files changed
+54 -48

No files matched your search

+11
View File
@@ -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