def testItemsEvent(self): """Testing multiple message/pubsub_event/items/item""" msg = self.Message() item = pubsub.EventItem() item2 = pubsub.EventItem() pl = ET.Element('{http://netflint.net/protocol/test}test', { 'failed': '3', 'passed': '24' }) pl2 = ET.Element('{http://netflint.net/protocol/test-other}test', { 'total': '27', 'failed': '3' }) item2['payload'] = pl2 item['payload'] = pl item['id'] = 'abc123' item2['id'] = '123abc' msg['pubsub_event']['items'].append(item) msg['pubsub_event']['items'].append(item2) msg['pubsub_event']['items']['node'] = 'cheese' msg['type'] = 'normal' self.check( msg, """ <message type="normal"> <event xmlns="http://jabber.org/protocol/pubsub#event"> <items node="cheese"> <item id="abc123"> <test xmlns="http://netflint.net/protocol/test" failed="3" passed="24" /> </item> <item id="123abc"> <test xmlns="http://netflint.net/protocol/test-other" failed="3" total="27" /> </item> </items> </event> </message>""")
def testMIXNewParticipant(self): msg = Message() msg['pubsub_event']['items']['node'] = 'urn:xmpp:mix:nodes:participants' item = pstanza.EventItem() item['id'] = '123456' item['mix_participant']['jid'] = JID('*****@*****.**') item['mix_participant']['nick'] = 'Titi' msg['pubsub_event']['items'].append(item) self.check(msg, """ <message> <event xmlns='http://jabber.org/protocol/pubsub#event'> <items node='urn:xmpp:mix:nodes:participants'> <item id='123456'> <participant xmlns='urn:xmpp:mix:core:1'> <jid>[email protected]</jid> <nick>Titi</nick> </participant> </item> </items> </event> </message> """, use_values=False)