Exemplo n.º 1
0
Arquivo: presence.py Projeto: dax/jmc
 def handle(self, stanza, lang_class, accounts):
     result = DefaultUnsubscribeHandler.handle(self, stanza, lang_class, accounts)
     legacy_jid = LegacyJID.select(\
        LegacyJID.q.jid == unicode(stanza.get_to()))
     if legacy_jid.count() == 1:
         legacy_jid[0].destroySelf()
     return result
Exemplo n.º 2
0
Arquivo: presence.py Projeto: dax/jcl
class DefaultUnsubscribeHandler_TestCase(unittest.TestCase):
    def setUp(self):
        self.handler = DefaultUnsubscribeHandler(None)

    def test_handle(self):
        presence = Presence(from_jid="*****@*****.**",
                            to_jid="*****@*****.**",
                            stanza_type="unsubscribe")
        result = self.handler.handle(presence, None, [])
        self.assertEquals(len(result), 2)
        self.assertEquals(result[0].get_to(), "*****@*****.**")
        self.assertEquals(result[0].get_from(), "*****@*****.**")
        self.assertEquals(result[0].get_type(), "unsubscribe")
        self.assertEquals(result[1].get_to(), "*****@*****.**")
        self.assertEquals(result[1].get_from(), "*****@*****.**")
        self.assertEquals(result[1].get_type(), "unsubscribed")