def expire_at_test(self): 'should set an expiration timestamp on an activity feed.' self.add_items_to_feed('david', Leaderboard.DEFAULT_PAGE_SIZE) t = datetime.datetime.now() + datetime.timedelta(seconds=10) self.a.expire_at('david', datetime_to_timestamp(t)) ttl = self.a.redis.ttl(self.a.feed_key('david')) self.assertEqual(1 < ttl <= 10, True)
def expire_at_test(self): 'should set an expiration timestamp on an activity feed.' self.add_items_to_feed('david', leaderboard.Leaderboard.DEFAULT_PAGE_SIZE) t = datetime.datetime.now() + datetime.timedelta(seconds=10) self.a.expire_at('david', datetime_to_timestamp(t)) ttl = self.a.redis.ttl(self.a.feed_key('david')) self.assertEqual(1 < ttl <= 10, True)
def timestamp_utcnow(): return datetime_to_timestamp(utcnow())
def timestamp(*args): return datetime_to_timestamp(datetime.datetime(*args))