def test_toElementVersionEmpty(self): """ If the roster version is the empty string, it should add 'ver', too. """ request = xmppim.RosterRequest() request.version = '' element = request.toElement() self.assertEqual('', element.query.getAttribute('ver'))
def test_toElementVersion(self): """ If the roster version is set, a 'ver' attribute is added. """ request = xmppim.RosterRequest() request.version = 'ver72' element = request.toElement() self.assertEqual('ver72', element.query.getAttribute('ver'))
def test_toElement(self): """ A roster request has a query element in the roster namespace. """ request = xmppim.RosterRequest() element = request.toElement() children = element.elements() child = next(children) self.assertEqual(NS_ROSTER, child.uri) self.assertEqual('query', child.name)
def test_toElementItem(self): """ If an item is set, it is rendered as a child of the query. """ request = xmppim.RosterRequest() request.item = xmppim.RosterItem(JID('*****@*****.**')) element = request.toElement() children = element.query.elements() child = next(children) self.assertEqual(NS_ROSTER, child.uri) self.assertEqual('item', child.name)