def test_is_expired_with_not_expired_esearch(self): """ is_expired() should return False for searches whose the interval between now() and executed_at is lesser than or equal to EXPIRATION_DELTA. """ expired_esearch = ESearch(executed_at=timezone.now()) self.assertEqual(expired_esearch.is_expired(), False)
def test_is_expired_with_expired_esearch(self): """ is_expired() should return True for searches whose the interval between now() and executed_at is greater than EXPIRATION_DELTA. """ expired_esearch = ESearch( executed_at=timezone.now() - ESearch.EXPIRATION_DELTA + timedelta.resolution) self.assertEqual(expired_esearch.is_expired(), True)