This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/data/cache/test/test_cache.py

17 lines
462 B
Python
Raw Normal View History

import pytest
from data.cache import InMemoryDataModelCache, NoopDataModelCache
from data.cache.cache_key import CacheKey
@pytest.mark.parametrize('cache_type', [
(NoopDataModelCache),
(InMemoryDataModelCache),
])
def test_caching(cache_type):
key = CacheKey('foo', '60m')
cache = cache_type()
# Perform two retrievals, and make sure both return.
assert cache.retrieve(key, lambda: 1234) == 1234
assert cache.retrieve(key, lambda: 1234) == 1234