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'))
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'))
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)))
def cb(info): discoInfo = disco.DiscoInfo() for item in info: discoInfo.append(item) self.assertNotIn('urn:xmpp:ping', discoInfo.features)
def cb(info): discoInfo = disco.DiscoInfo() self.assertEqual([], info) self.assertNotIn('http://jarn.com/ns/collaborative-editing', discoInfo.features)
def cb(info): discoInfo = disco.DiscoInfo() for item in info: discoInfo.append(item) self.assertIn('http://jarn.com/ns/collaborative-editing', discoInfo.features)