Mercurial > libervia-backend
comparison tests/unit/test_plugin_xep_0215.py @ 4321:2246eeeccc74
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`
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 30 Sep 2024 14:15:47 +0200 |
parents | 4b842c1fb686 |
children |
comparison
equal
deleted
inserted
replaced
4320:9658c534287e | 4321:2246eeeccc74 |
---|---|
16 # You should have received a copy of the GNU Affero General Public License | 16 # You should have received a copy of the GNU Affero General Public License |
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 |
19 from twisted.internet import defer | 19 from twisted.internet import defer |
20 from pytest_twisted import ensureDeferred as ed | 20 from pytest_twisted import ensureDeferred as ed |
21 from unittest.mock import MagicMock | 21 from unittest.mock import AsyncMock, MagicMock |
22 from libervia.backend.plugins.plugin_xep_0215 import XEP_0215 | 22 from libervia.backend.plugins.plugin_xep_0215 import XEP_0215 |
23 from libervia.backend.tools import xml_tools | 23 from libervia.backend.tools import xml_tools |
24 from twisted.words.protocols.jabber import jid | 24 from twisted.words.protocols.jabber import jid |
25 | 25 |
26 | 26 |
27 class TestXEP0215: | 27 class TestXEP0215: |
28 def test_parse_services(self, host): | 28 def test_parse_services(self, host): |
29 """Services are parsed correctly""" | 29 """Services are parsed correctly""" |
30 xep_0215 = XEP_0215(host) | 30 xep_0215 = XEP_0215(host) |
31 host.memory.disco.has_feature = AsyncMock() | |
32 host.memory.disco.has_feature.return_value = True | |
33 | |
31 | 34 |
32 services_elt = xml_tools.parse( | 35 services_elt = xml_tools.parse( |
33 """ | 36 """ |
34 <services xmlns="urn:xmpp:extdisco:2"> | 37 <services xmlns="urn:xmpp:extdisco:2"> |
35 <service host="test.example" type="stun" port="1234" /> | 38 <service host="test.example" type="stun" port="1234" /> |