diff --git a/test/no_gui/unit/test_caps_cache.py b/test/no_gui/unit/test_caps_cache.py index 0fb2204ae..28c61afc2 100644 --- a/test/no_gui/unit/test_caps_cache.py +++ b/test/no_gui/unit/test_caps_cache.py @@ -8,8 +8,8 @@ from nbxmpp import NS_MUC, NS_PING, NS_XHTML_IM, Iq from gajim.common import caps_cache as caps from gajim.common.modules.discovery import Discovery -COMPLEX_EXAMPLE = ''' - +EXAMPLES = [ +''' @@ -39,7 +39,94 @@ COMPLEX_EXAMPLE = ''' -''' + +''', + +''' + + + + + + + + + + + + + + + + + +''', + +''' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +''', +] class CommonCapsTest(unittest.TestCase): @@ -125,10 +212,12 @@ class TestCapsCache(CommonCapsTest): def test_hash(self): '''tests the hash computation''' - stanza = Iq(node=COMPLEX_EXAMPLE) - identities, features, data, _ = Discovery.parse_info_response(stanza) - computed_hash = caps.compute_caps_hash(identities, features, data) - self.assertEqual('q07IKJEyjvHSyhy//CH0CxmKi8w=', computed_hash) + for example in EXAMPLES: + stanza = Iq(node=example) + identities, features, data, node = Discovery.parse_info_response(stanza) + computed_hash = caps.compute_caps_hash(identities, features, data) + hash_ = node.split('#')[1] + self.assertEqual(hash_, computed_hash) class TestClientCaps(CommonCapsTest):