tests (unit): Fix tests.
This commit is contained in:
parent
3a2a5f787d
commit
e68278a1ac
1 changed files with 88 additions and 102 deletions
|
|
@ -24,7 +24,6 @@ from libervia.backend.core.constants import Const as C
|
|||
|
||||
|
||||
class TestPubsubCache:
|
||||
|
||||
@ed
|
||||
async def test_cache_is_used_transparently(self, host, client):
|
||||
"""Cache is used when a pubsub get_items operation is done"""
|
||||
|
|
@ -61,12 +60,16 @@ class TestPubsubCache:
|
|||
@ed
|
||||
async def test_cache_is_not_used_when_no_cache(self, host, client):
|
||||
"""Cache is skipped when 'pubsub_cache_strategy' is set to 'no_cache'"""
|
||||
with host.use_option_and_reload(None, "pubsub_cache_strategy", "no_cache"):
|
||||
with patch("libervia.backend.plugins.plugin_pubsub_cache.G") as mock_G:
|
||||
mock_G.config.common.pubsub_cache_strategy = "no_cache"
|
||||
|
||||
items_ret = defer.Deferred()
|
||||
items_ret.callback(([], {}))
|
||||
client.pubsub_client.items = MagicMock(return_value=items_ret)
|
||||
host.memory.storage.get_pubsub_node.return_value = None
|
||||
host.memory.storage.set_pubsub_node.return_value = PubsubNode(sync_state=None)
|
||||
host.memory.storage.set_pubsub_node.return_value = PubsubNode(
|
||||
sync_state=None
|
||||
)
|
||||
with patch.object(host.plugins["PUBSUB_CACHE"], "cache_node") as cache_node:
|
||||
await host.plugins["XEP-0060"].get_items(
|
||||
client,
|
||||
|
|
|
|||
Loading…
Reference in a new issue