def test_refresh_token(self): api = APIManager("CLIENT_ID", "CLIENT_SECRET", self.server.path) api.access_token['requested_at'] = datetime.datetime.now( ) - datetime.timedelta(hours=2) self.assertFalse(api.is_access_token_valid()) api.get("api_manager?parameter") self.assertTrue(api.is_access_token_valid())
def test_refresh_token(self): api = APIManager("CLIENT_ID", "CLIENT_SECRET", self.server.path, compression_enabled=False, backoff_config=None, token_override=None) api.access_token['requested_at'] = datetime.datetime.now( ) - datetime.timedelta(hours=2) self.assertFalse(api.is_access_token_valid()) api.get("/api/v3/api_manager?parameter") self.assertTrue(api.is_access_token_valid())
def test_token_is_valid(self): api = APIManager("CLIENT_ID", "CLIENT_SECRET", self.server.path, compression_enabled=False, backoff_config=None, token_override=None) self.assertTrue(api.is_access_token_valid())
def test_token_invalid(self): api = APIManager("CLIENT_ID", "CLIENT_SECRET", self.server.path) api.access_token['requested_at'] = datetime.datetime.now( ) - datetime.timedelta(hours=2) self.assertFalse(api.is_access_token_valid())
def test_token_is_valid(self): api = APIManager("CLIENT_ID", "CLIENT_SECRET", self.server.path) self.assertTrue(api.is_access_token_valid())