def test_make_ratelimit_cache_key_1w(self): self.now = 7 * 24 * 3600 + 5 ts = ratelimit.get_timeslice(24 * 3600) key = ratelimit._make_ratelimit_cache_key('a', ts) self.assertEquals('rl:a-@604800', key)
def test_make_ratelimit_cache_key_1m(self): self.now = 65 ts = ratelimit.get_timeslice(60) key = ratelimit._make_ratelimit_cache_key('a', ts) self.assertEquals('rl:a-000100', key)
def test_make_ratelimit_cache_key_1h(self): self.now = 3650 ts = ratelimit.get_timeslice(3600) key = ratelimit._make_ratelimit_cache_key('a', ts) self.assertEquals('rl:a-010000', key)
def test_make_ratelimit_cache_key_1s(self): self.now = 14 ts = ratelimit.get_timeslice(1) key = ratelimit._make_ratelimit_cache_key('a', ts) self.assertEquals('rl:a-000014', key)