Пример #1
0
 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'))
Пример #2
0
 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'))
Пример #3
0
 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)
Пример #4
0
 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)