コード例 #1
0
ファイル: stanza_test.py プロジェクト: josejamilena/headstock
    def test_to_element(self):
        stanza = Stanza(name="iq", from_jid="bob", to_jid="alice", type="get", stanza_id="i")
        xml = """<?xml version="1.0" encoding="UTF-8"?>
<iq xmlns="jabber:client" to="alice" type="get" id="i" from="bob" />"""
        self.assertEqual(Stanza.to_element(stanza).xml(), xml)
        stanza.swap_jids()
        xml_swapped = """<?xml version="1.0" encoding="UTF-8"?>
<iq xmlns="jabber:client" to="bob" type="get" id="i" from="alice" />"""
        self.assertEqual(Stanza.to_element(stanza).xml(), xml_swapped)
コード例 #2
0
 def notify_presence(self):
     """
     Creates and returns a presence stanza as a
     :class:`bridge.Element` instance.
     """
     return Stanza.to_element(Stanza(u'presence'))