From 717e1543d3290e377d59e565004c3a1e0efd3476 Mon Sep 17 00:00:00 2001 From: David Rousselie Date: Thu, 30 Nov 2006 22:56:36 +0100 Subject: [PATCH] Add handle_presence_subscribed test darcs-hash:20061130215636-86b55-55c02e41cd14be5b752f1a187ef3834abb632425.gz --- src/jcl/jabber/component.py | 11 ----------- tests/jcl/jabber/test_component.py | 8 +++++++- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/jcl/jabber/component.py b/src/jcl/jabber/component.py index 06a5b75..a71c2bc 100644 --- a/src/jcl/jabber/component.py +++ b/src/jcl/jabber/component.py @@ -535,17 +535,6 @@ class JCLComponent(Component, object): """Handle subscribed presence from user """ self.__logger.debug("PRESENCE_SUBSCRIBED") - name = stanza.get_to().node - from_jid = stanza.get_from() - base_from_jid = unicode(from_jid.bare()) -# accounts = self.account_class.select(\ -# self.account_class.q.user_jid == base_from_jid -# and self.account_class.q.name == name) -# if accounts.count() >= 1: -# _account = list(accounts)[0] -# self._send_presence_available(_account, "show", lang_class) - # TODO : send presence available to subscribed user - # is it necessary to send available presence ? return 1 def handle_presence_unsubscribe(self, stanza): diff --git a/tests/jcl/jabber/test_component.py b/tests/jcl/jabber/test_component.py index 23689bb..75df31e 100644 --- a/tests/jcl/jabber/test_component.py +++ b/tests/jcl/jabber/test_component.py @@ -1421,7 +1421,13 @@ class JCLComponent_TestCase(unittest.TestCase): presence_sent = self.comp.stream.sent self.assertEqual(len(presence_sent), 0) - def test_handle_presence_unsubscribe(self): + def test_handle_presence_subscribed(self): + self.comp.stream = MockStream() + self.comp.stream_class = MockStream + self.comp.handle_presence_subscribed(None) + self.assertEqual(len(self.comp.stream.sent), 0) + + def test_handle_presence_unsubscribe_to_account(self): self.comp.stream = MockStream() self.comp.stream_class = MockStream account.hub.threadConnection = connectionForURI('sqlite://' + DB_URL)