feat(generator): add no-op cache wrapper (enables Redis later via env)

This commit is contained in:
shay
2026-04-17 16:44:38 -04:00
parent 361c938985
commit a0c5e8a86e
2 changed files with 52 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
from src import cache
def test_noop_when_redis_url_empty(monkeypatch):
monkeypatch.setattr(cache.config, "REDIS_URL", "")
c = cache.Cache()
assert c.get("k") is None
c.set("k", "v", 60)
c.delete("k")
assert c.get("k") is None # still None because no-op
def test_enabled_flag_reflects_config(monkeypatch):
monkeypatch.setattr(cache.config, "REDIS_URL", "")
assert cache.Cache().enabled is False