Beispiel #1
0
    def test_toElementNode(self):
        """
        Test C{toElement} with a node.
        """
        info = disco.DiscoInfo()
        info.nodeIdentifier = u'test'
        element = info.toElement()

        self.assertEqual(u'test', element.getAttribute(u'node'))
Beispiel #2
0
    def test_toElement(self):
        """
        Test C{toElement} creates a correctly namespaced element, no node.
        """
        info = disco.DiscoInfo()
        element = info.toElement()

        self.assertEqual(NS_DISCO_INFO, element.uri)
        self.assertEqual(u'query', element.name)
        self.assertFalse(element.hasAttribute(u'node'))
Beispiel #3
0
    def test_toElementChildren(self):
        """
        Test C{toElement} creates a DOM with proper childs.
        """
        info = disco.DiscoInfo()
        info.append(disco.DiscoFeature(u'jabber:iq:register'))
        info.append(disco.DiscoIdentity(u'conference', u'text'))
        info.append(data_form.Form(u'result'))
        element = info.toElement()

        featureElements = domish.generateElementsQNamed(
            element.children, u'feature', NS_DISCO_INFO)
        self.assertEqual(1, len(list(featureElements)))

        identityElements = domish.generateElementsQNamed(
            element.children, u'identity', NS_DISCO_INFO)
        self.assertEqual(1, len(list(identityElements)))

        extensionElements = domish.generateElementsQNamed(
            element.children, u'x', data_form.NS_X_DATA)
        self.assertEqual(1, len(list(extensionElements)))
Beispiel #4
0
 def cb(info):
     discoInfo = disco.DiscoInfo()
     for item in info:
         discoInfo.append(item)
     self.assertNotIn('urn:xmpp:ping', discoInfo.features)
Beispiel #5
0
 def cb(info):
     discoInfo = disco.DiscoInfo()
     self.assertEqual([], info)
     self.assertNotIn('http://jarn.com/ns/collaborative-editing',
                      discoInfo.features)
Beispiel #6
0
 def cb(info):
     discoInfo = disco.DiscoInfo()
     for item in info:
         discoInfo.append(item)
     self.assertIn('http://jarn.com/ns/collaborative-editing',
                   discoInfo.features)