12 lines
371 B
Python
12 lines
371 B
Python
from app.public_cache import PublicResponseCache
|
|
|
|
|
|
def test_cache_copies_values_and_invalidates() -> None:
|
|
cache = PublicResponseCache()
|
|
original = [{"score": 10}]
|
|
cache.set(("activity",), original)
|
|
original[0]["score"] = 99
|
|
assert cache.get(("activity",), 20) == [{"score": 10}]
|
|
cache.invalidate()
|
|
assert cache.get(("activity",), 20) is None
|