Skip to content

Commit

Permalink
Add additional testcase for GAE
Browse files Browse the repository at this point in the history
  • Loading branch information
alisaifee committed May 18, 2020
1 parent 87afb8e commit c5426db
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_storage.py
Expand Up @@ -489,3 +489,15 @@ def test_fixed_window(self):
while time.time() - start <= 1:
time.sleep(0.1)
self.assertTrue(limiter.hit(per_min))

def test_fixed_window_with_elastic_expiry_cluster(self):
storage = GAEMemcachedStorage("gaememcached://")
limiter = FixedWindowElasticExpiryRateLimiter(storage)
per_sec = RateLimitItemPerSecond(2, 2)

self.assertTrue(limiter.hit(per_sec))
self.assertTrue(limiter.hit(per_sec))
time.sleep(1)
self.assertFalse(limiter.test(per_sec))
time.sleep(1)
self.assertTrue(limiter.test(per_sec))

0 comments on commit c5426db

Please sign in to comment.