def test_is_newer_than(self): now = timeutil.utcnow() after = now + MINS_15 self.assertFalse(timeutil.is_newer_than(after, timeutil.ONE_HOUR)) after = now + MINS_30 self.assertFalse(timeutil.is_newer_than(after, timeutil.ONE_HOUR)) after = now + MINS_45 self.assertFalse(timeutil.is_newer_than(after, timeutil.ONE_HOUR)) after = now + ONE_HOUR self.assertTrue(timeutil.is_newer_than(after, timeutil.ONE_HOUR))
def token_expired(self): """Provide access to flag indicating if token has expired.""" if self._token_timer is None: return True return timeutil.is_newer_than(self._token_timer, timeutil.ONE_HOUR)