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

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

        self.assertEqual(NS_DISCO_ITEMS, element.uri)
        self.assertEqual(u'query', element.name)
        self.assertFalse(element.hasAttribute(u'node'))
Exemple #3
0
    def test_toElementChildren(self):
        """
        Test C{toElement} creates a DOM with proper childs.
        """
        items = disco.DiscoItems()
        items.append(disco.DiscoItem(JID(u'example.org'), u'test', u'A node'))
        element = items.toElement()

        itemElements = domish.generateElementsQNamed(element.children, u'item',
                                                     NS_DISCO_ITEMS)
        self.assertEqual(1, len(list(itemElements)))