Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_is_expired(self):
access = {'expires_in': 7200}
now = datetime.utcnow()
two_hours_from_now = (datetime.utcnow() + timedelta(hours=2.5))
access['expiration'] = (datetime.utcnow() + timedelta(seconds=access['expires_in']))
self.assertTrue(now <= access['expiration'] < two_hours_from_now)
self.assertFalse(smartcar.is_expired(access['expiration']))
access['expiration'] = (datetime.utcnow() - timedelta(hours=2.1))
self.assertTrue(smartcar.is_expired(access['expiration']))
def test_is_expired(self):
access = {'expires_in': 7200}
now = datetime.utcnow()
two_hours_from_now = (datetime.utcnow() + timedelta(hours=2.5))
access['expiration'] = (datetime.utcnow() + timedelta(seconds=access['expires_in']))
self.assertTrue(now <= access['expiration'] < two_hours_from_now)
self.assertFalse(smartcar.is_expired(access['expiration']))
access['expiration'] = (datetime.utcnow() - timedelta(hours=2.1))
self.assertTrue(smartcar.is_expired(access['expiration']))