def test_iq_result_empty(self): iq = Iq( to_jid=JID("[email protected]/res"), from_jid=JID("*****@*****.**"), stanza_type="result", stanza_id=2 ) self.check_iq4(iq) xml = iq.as_xml() self.check_iq4(Iq(xml))
def test_iq_result_empty(self): iq = Iq(to_jid=JID("[email protected]/res"), from_jid=JID("*****@*****.**"), stanza_type="result", stanza_id=2) self.check_iq4(iq) xml = iq.as_xml() self.check_iq4(Iq(xml))
def test_iq_set(self): iq = Iq(from_jid=JID("[email protected]/res"), to_jid=JID("*****@*****.**"), stanza_type="set", stanza_id=2) payload = ElementTree.Element("{http://pyxmpp.jajcus.net/xmlns/test}payload") ElementTree.SubElement(payload, "{http://pyxmpp.jajcus.net/xmlns/test}abc") payload = XMLPayload(payload) iq.add_payload(payload) self.check_iq3(iq) xml = iq.as_xml() self.check_iq3(Iq(xml))
def test_iq_set(self): iq = Iq(from_jid=JID("[email protected]/res"), to_jid=JID("*****@*****.**"), stanza_type="set", stanza_id=2) payload = ElementTree.Element( "{http://pyxmpp.jajcus.net/xmlns/test}payload") ElementTree.SubElement(payload, "{http://pyxmpp.jajcus.net/xmlns/test}abc") payload = XMLPayload(payload) iq.add_payload(payload) self.check_iq3(iq) xml = iq.as_xml() self.check_iq3(Iq(xml))
def handle_authorized(self, event): iq = Iq(ElementTree.XML(self.xml)) log.info("send_xml --> {0}".format(ElementTree.tostring(iq.as_xml()))) event.stream.send(iq) event.stream.disconnect()