# HG changeset patch # User Goffi # Date 1727698547 -7200 # Node ID 2246eeeccc744a6b29bb1ba82019dc3dd1612f6c # Parent 9658c534287e3c11bf9faf1acd3b14986e91a20c tests (unit): fix tests: - test_ap-gateway: fix missing implementation of `client.is_local` - test_plugin_xep_0215: fix missing return value of `has_feature` diff -r 9658c534287e -r 2246eeeccc74 tests/unit/test_ap-gateway.py --- a/tests/unit/test_ap-gateway.py Mon Sep 30 14:14:38 2024 +0200 +++ b/tests/unit/test_ap-gateway.py Mon Sep 30 14:15:47 2024 +0200 @@ -36,6 +36,7 @@ from libervia.backend.core import exceptions from libervia.backend.core.constants import Const as C +from libervia.backend.core.xmpp import SatXMPPComponent from libervia.backend.memory.sqla_mapping import SubscriptionState from libervia.backend.plugins import plugin_comp_ap_gateway from libervia.backend.plugins.plugin_comp_ap_gateway import constants as ap_const @@ -386,6 +387,7 @@ client.host = "test.example" client._ap_storage.get = AsyncMock() client._ap_storage.aset = AsyncMock() + client.is_local = lambda jid_: SatXMPPComponent.is_local(client, jid_) return client diff -r 9658c534287e -r 2246eeeccc74 tests/unit/test_plugin_xep_0215.py --- a/tests/unit/test_plugin_xep_0215.py Mon Sep 30 14:14:38 2024 +0200 +++ b/tests/unit/test_plugin_xep_0215.py Mon Sep 30 14:15:47 2024 +0200 @@ -18,7 +18,7 @@ from twisted.internet import defer from pytest_twisted import ensureDeferred as ed -from unittest.mock import MagicMock +from unittest.mock import AsyncMock, MagicMock from libervia.backend.plugins.plugin_xep_0215 import XEP_0215 from libervia.backend.tools import xml_tools from twisted.words.protocols.jabber import jid @@ -28,6 +28,9 @@ def test_parse_services(self, host): """Services are parsed correctly""" xep_0215 = XEP_0215(host) + host.memory.disco.has_feature = AsyncMock() + host.memory.disco.has_feature.return_value = True + services_elt = xml_tools.parse( """