tests (unit): Fix tests.

This commit is contained in:
Goffi 2025-12-03 17:43:06 +01:00
commit e68278a1ac

View file

@ -66,17 +66,13 @@ class PubsubCache:
def __init__(self, host):
log.info(_("PubSub Cache initialization"))
strategy = G.config.common.pubsub_cache_strategy
if strategy == "no_cache":
if (strategy := G.config.common.pubsub_cache_strategy) == "no_cache":
log.info(
_(
"Pubsub cache won't be used due to pubsub_cache_strategy={value} "
"setting."
).format(value=repr(strategy))
)
self.use_cache = False
else:
self.use_cache = True
self.host = host
self._p = host.plugins["XEP-0060"]
self.analysers = {}
@ -592,7 +588,10 @@ class PubsubCache:
rsm_request: Optional[rsm.RSMRequest],
extra: dict,
) -> Tuple[bool, Optional[Tuple[List[dict], dict]]]:
if not self.use_cache:
# Check if cache is disabled by configuration (checking at runtime to handle
# dynamic config changes)
from pudb import set_trace; set_trace()
if G.config.common.pubsub_cache_strategy == "no_cache":
log.debug("cache disabled in settings")
return True, None
if extra.get(C.KEY_USE_CACHE) == False: