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'))
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'))
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)))