How to use the smartcar.is_expired function in smartcar

To help you get started, we’ve selected a few smartcar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github smartcar / python-sdk / tests / test_smartcar.py View on Github external
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']))
github smartcar / python-sdk / tests / test_smartcar.py View on Github external
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']))