def test_cache_no_fallthrough_expiration_time_fn(self): self._add_dummy_config_group() # Since we do not re-configure the cache region, for ease of testing # this value is set the same as the expiration_time default in the # [cache] group cache_time = 600 expiration_time = cache._get_expiration_time_fn( self.config_fixture.conf, TEST_GROUP) do_test = self._get_cache_fallthrough_fn(cache_time) # Run the test with the dummy group cache_time value self.config_fixture.config(cache_time=cache_time, group=TEST_GROUP) test_value = TestProxyValue(uuid.uuid4().hex) self.assertEqual(cache_time, expiration_time()) do_test(value=test_value)
def test_cache_fallthrough_expiration_time_fn(self): self._add_dummy_config_group() # Since we do not re-configure the cache region, for ease of testing # this value is set the same as the expiration_time default in the # [cache] group cache_time = 599 expiration_time = cache._get_expiration_time_fn( self.config_fixture.conf, TEST_GROUP) do_test = self._get_cache_fallthrough_fn(cache_time) # Run the test with the dummy group cache_time value set to None and # the global value set. self.config_fixture.config(cache_time=None, group=TEST_GROUP) test_value = TestProxyValue(uuid.uuid4().hex) self.assertIsNone(expiration_time()) do_test(value=test_value)
def test_cache_no_fallthrough_expiration_time_fn(self): self._add_dummy_config_group() # Since we do not re-configure the cache region, for ease of testing # this value is set the same as the expiration_time default in the # [cache] group cache_time = 600 expiration_time = cache._get_expiration_time_fn( self.config_fixture.conf, TEST_GROUP) do_test = self._get_cache_fallthrough_fn(cache_time) # Run the test with the dummy group cache_time value self.config_fixture.config(cache_time=cache_time, group=TEST_GROUP) test_value = TestProxyValue(uuidutils.generate_uuid(dashed=False)) self.assertEqual(cache_time, expiration_time()) do_test(value=test_value)
def test_cache_fallthrough_expiration_time_fn(self): self._add_dummy_config_group() # Since we do not re-configure the cache region, for ease of testing # this value is set the same as the expiration_time default in the # [cache] group cache_time = 599 expiration_time = cache._get_expiration_time_fn( self.config_fixture.conf, TEST_GROUP) do_test = self._get_cache_fallthrough_fn(cache_time) # Run the test with the dummy group cache_time value set to None and # the global value set. self.config_fixture.config(cache_time=None, group=TEST_GROUP) test_value = TestProxyValue(uuidutils.generate_uuid(dashed=False)) self.assertIsNone(expiration_time()) do_test(value=test_value)