Beispiel #1
0
 def test_append_time_slice_1w(self):
     self.now = 7 * 24 * 3600 + 5
     ts = ratelimit.get_timeslice(24 * 3600)
     key = ratelimit._append_time_slice('a', ts)
     self.assertEquals('a-@604800', key)
Beispiel #2
0
 def test_append_time_slice_1m(self):
     self.now = 65
     ts = ratelimit.get_timeslice(60)
     key = ratelimit._append_time_slice('a', ts)
     self.assertEquals('a-000100', key)
Beispiel #3
0
 def test_append_time_slice_1h(self):
     self.now = 3650
     ts = ratelimit.get_timeslice(3600)
     key = ratelimit._append_time_slice('a', ts)
     self.assertEquals('a-010000', key)
Beispiel #4
0
 def test_append_time_slice_1s(self):
     self.now = 14
     ts = ratelimit.get_timeslice(1)
     key = ratelimit._append_time_slice('a', ts)
     self.assertEquals('a-000014', key)