Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2019-06-29 18:41:23 +0300
committerPhilipp Hörist <philipp@hoerist.com>2019-06-29 18:41:23 +0300
commita4c7b0132f3671a765a8f707bf238403434e370d (patch)
tree65281d10739fc6fedf5a52b3eb271af0e4005708 /test
parent1e1ced9ae712705278d1a2954ece7fd7388b9b84 (diff)
Use nbxmpp's compute_caps_hash()
Diffstat (limited to 'test')
-rw-r--r--test/no_gui/unit/test_caps_cache.py139
1 files changed, 2 insertions, 137 deletions
diff --git a/test/no_gui/unit/test_caps_cache.py b/test/no_gui/unit/test_caps_cache.py
index d96798ac9..bb4a50ef3 100644
--- a/test/no_gui/unit/test_caps_cache.py
+++ b/test/no_gui/unit/test_caps_cache.py
@@ -2,134 +2,12 @@
Tests for capabilities and the capabilities cache
'''
import unittest
-import weakref
-
from unittest.mock import MagicMock, Mock
-from nbxmpp import NS_MUC, NS_PING, NS_XHTML_IM, Iq
+
+from nbxmpp import NS_MUC, NS_PING, NS_XHTML_IM
from nbxmpp.structs import DiscoIdentity
-from nbxmpp.modules.discovery import Discovery
from gajim.common import caps_cache as caps
-EXAMPLES = [
-'''<iq type='result'>
-<query xmlns='http://jabber.org/protocol/disco#info' node='http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w='>
-<identity xml:lang='en' category='client' name='Psi 0.11' type='pc'/>
-<identity xml:lang='el' category='client' name='Ψ 0.11' type='pc'/>
-<feature var='http://jabber.org/protocol/caps'/>
-<feature var='http://jabber.org/protocol/disco#info'/>
-<feature var='http://jabber.org/protocol/disco#items'/>
-<feature var='http://jabber.org/protocol/muc'/>
-<x xmlns='jabber:x:data' type='result'>
-<field var='FORM_TYPE' type='hidden'>
-<value>urn:xmpp:dataforms:softwareinfo</value>
-</field>
-<field var='ip_version'>
-<value>ipv4</value>
-<value>ipv6</value>
-</field>
-<field var='os'>
-<value>Mac</value>
-</field>
-<field var='os_version'>
-<value>10.5.1</value>
-</field>
-<field var='software'>
-<value>Psi</value>
-</field>
-<field var='software_version'>
-<value>0.11</value>
-</field>
-</x>
-</query>
-</iq>
-''',
-
-'''<iq type='result'>
-<query node="http://bombusmod.net.ru/caps#tbBQGBMv8g8U7kW55TEZZRnMCJ4=" xmlns="http://jabber.org/protocol/disco#info">
-<identity category="client" name="BombusMod" type="mobile"/>
-<feature var="http://jabber.org/protocol/chatstates"/>
-<feature var="http://jabber.org/protocol/disco#info"/>
-<feature var="http://jabber.org/protocol/disco#items"/>
-<feature var="http://jabber.org/protocol/rosterx"/>
-<feature var="jabber:iq:last"/>
-<feature var="jabber:iq:privacy"/>
-<feature var="jabber:iq:roster"/>
-<feature var="jabber:iq:time"/>
-<feature var="jabber:iq:version"/>
-<feature var="jabber:x:oob"/>
-<feature var="urn:xmpp:ping"/>
-<feature var="urn:xmpp:receipts"/>
-<feature var="urn:xmpp:time"/>
-</query>
-</iq>
-''',
-
-'''<iq type='result'>
-<query node="http://jappix.org/#qRsaGbKTz8EwAOakYO00InkZUxM=" xmlns="http://jabber.org/protocol/disco#info">
- <identity category="client" name="Jappix" type="web"/>
- <feature var="http://jabber.org/protocol/activity"/>
- <feature var="http://jabber.org/protocol/activity+notify"/>
- <feature var="http://jabber.org/protocol/caps"/>
- <feature var="http://jabber.org/protocol/chatstates"/>
- <feature var="http://jabber.org/protocol/commands"/>
- <feature var="http://jabber.org/protocol/disco#info"/>
- <feature var="http://jabber.org/protocol/disco#items"/>
- <feature var="http://jabber.org/protocol/geoloc"/>
- <feature var="http://jabber.org/protocol/geoloc+notify"/>
- <feature var="http://jabber.org/protocol/http-auth"/>
- <feature var="http://jabber.org/protocol/httpbind"/>
- <feature var="http://jabber.org/protocol/mood"/>
- <feature var="http://jabber.org/protocol/mood+notify"/>
- <feature var="http://jabber.org/protocol/muc"/>
- <feature var="http://jabber.org/protocol/muc#admin"/>
- <feature var="http://jabber.org/protocol/muc#owner"/>
- <feature var="http://jabber.org/protocol/muc#roomconfig"/>
- <feature var="http://jabber.org/protocol/muc#user"/>
- <feature var="http://jabber.org/protocol/nick"/>
- <feature var="http://jabber.org/protocol/pubsub#retrieve-items"/>
- <feature var="http://jabber.org/protocol/rosterx"/>
- <feature var="http://jabber.org/protocol/tune"/>
- <feature var="http://jabber.org/protocol/tune+notify"/>
- <feature var="http://jabber.org/protocol/xhtml-im"/>
- <feature var="ipv6"/>
- <feature var="jabber:iq:last"/>
- <feature var="jabber:iq:oob"/>
- <feature var="jabber:iq:privacy"/>
- <feature var="jabber:iq:private"/>
- <feature var="jabber:iq:register"/>
- <feature var="jabber:iq:roster"/>
- <feature var="jabber:iq:search"/>
- <feature var="jabber:iq:version"/>
- <feature var="jabber:x:data"/>
- <feature var="jabber:x:oob"/>
- <feature var="urn:ietf:params:xml:ns:vcard-4.0"/>
- <feature var="urn:ietf:rfc:3264"/>
- <feature var="urn:xmpp:avatar:data"/>
- <feature var="urn:xmpp:avatar:metadata"/>
- <feature var="urn:xmpp:delay"/>
- <feature var="urn:xmpp:extdisco:1"/>
- <feature var="urn:xmpp:inbox"/>
- <feature var="urn:xmpp:inbox+notify"/>
- <feature var="urn:xmpp:jingle:1"/>
- <feature var="urn:xmpp:jingle:apps:rtp:1"/>
- <feature var="urn:xmpp:jingle:apps:rtp:audio"/>
- <feature var="urn:xmpp:jingle:apps:rtp:rtcp-fb:0"/>
- <feature var="urn:xmpp:jingle:apps:rtp:rtp-hdrext:0"/>
- <feature var="urn:xmpp:jingle:apps:rtp:video"/>
- <feature var="urn:xmpp:jingle:apps:rtp:zrtp:1"/>
- <feature var="urn:xmpp:jingle:transports:ice-udp:1"/>
- <feature var="urn:xmpp:mam:0"/>
- <feature var="urn:xmpp:microblog:0"/>
- <feature var="urn:xmpp:microblog:0+notify"/>
- <feature var="urn:xmpp:ping"/>
- <feature var="urn:xmpp:receipts"/>
- <feature var="urn:xmpp:time"/>
- <feature var="urn:xmpp:tmp:jingle:apps:dtls:0"/>
- <feature var="vcard-temp"/>
-</query>
-</iq>''',
-]
-
class CommonCapsTest(unittest.TestCase):
@@ -214,19 +92,6 @@ class TestCapsCache(CommonCapsTest):
self.assertEqual(0, connection.get_module('Discovery').disco_contact.call_count)
- def test_hash(self):
- '''tests the hash computation'''
- for example in EXAMPLES:
- stanza = Iq(node=example)
- disco_module = Discovery(None)
- weak_callback = weakref.WeakMethod(self.disco_info_received)
- disco_module._disco_info_received(None, stanza, callback=weak_callback)
-
- def disco_info_received(self, info):
- computed_hash = caps.compute_caps_hash(info.identities, info.features, info.dataforms)
- hash_ = info.node.split('#')[1]
- self.assertEqual(hash_, computed_hash)
-
class TestClientCaps(CommonCapsTest):