Beispiel #1
0
def test_ratelimit_must_expires_according_to_ttl():
    rl = RateLimit()
    rl.refresh("foobar")
    ok_(not rl.expired("foobar", 0.5))
    time.sleep(1)
    ok_(rl.expired("foobar", 0.5))
Beispiel #2
0
def test_ratelimit_with_negative_ttls_expires_immediately():
    rl = RateLimit()
    rl.refresh("foobar")
    ok_(rl.expired("foobar", -1))