def test_with_refresh_exception(self): config_fetcher = ConfigFetcherWithErrorMock(Exception("error")) config_cache = InMemoryConfigCache() cache_policy = ManualPollingCachePolicy(config_fetcher, config_cache) cache_policy.force_refresh() value = cache_policy.get() self.assertEqual(value, None) cache_policy.stop()
def test_exception(self): config_fetcher = ConfigFetcherWithErrorMock(Exception("error")) config_cache = InMemoryConfigCache() cache_policy = LazyLoadingCachePolicy(config_fetcher, config_cache, 160) # Get value from Config Store, which indicates a config_fetcher call value = cache_policy.get() self.assertEqual(value, None) cache_policy.stop()
def test_http_error(self): config_fetcher = ConfigFetcherWithErrorMock(HTTPError("error")) config_cache = InMemoryConfigCache() cache_policy = AutoPollingCachePolicy(config_fetcher, config_cache, cache_key, 60, 1) # Get value from Config Store, which indicates a config_fetcher call value = cache_policy.get() self.assertEqual(value, None) cache_policy.stop()