File size: 728 Bytes
1e732dd
 
 
 
 
 
 
 
 
 
9659593
1e732dd
 
 
 
 
9659593
1e732dd
 
 
 
 
 
9659593
1e732dd
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Tests for src/services/cache/redis_cache.py — graceful degradation.
"""


class TestNullCache:
    """When Redis is disabled, the NullCache should degrade gracefully."""

    def test_null_cache_get_returns_none(self):
        from src.services.cache.redis_cache import _NullCache

        cache = _NullCache()
        assert cache.get("anything") is None

    def test_null_cache_set_noop(self):
        from src.services.cache.redis_cache import _NullCache

        cache = _NullCache()
        # Should not raise
        cache.set("key", "value", ttl=10)

    def test_null_cache_delete_noop(self):
        from src.services.cache.redis_cache import _NullCache

        cache = _NullCache()
        cache.delete("key")