Add handle_presence_subscribed test
darcs-hash:20061130215636-86b55-55c02e41cd14be5b752f1a187ef3834abb632425.gz
This commit is contained in:
@@ -535,17 +535,6 @@ class JCLComponent(Component, object):
|
|||||||
"""Handle subscribed presence from user
|
"""Handle subscribed presence from user
|
||||||
"""
|
"""
|
||||||
self.__logger.debug("PRESENCE_SUBSCRIBED")
|
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
|
return 1
|
||||||
|
|
||||||
def handle_presence_unsubscribe(self, stanza):
|
def handle_presence_unsubscribe(self, stanza):
|
||||||
|
|||||||
@@ -1421,7 +1421,13 @@ class JCLComponent_TestCase(unittest.TestCase):
|
|||||||
presence_sent = self.comp.stream.sent
|
presence_sent = self.comp.stream.sent
|
||||||
self.assertEqual(len(presence_sent), 0)
|
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 = MockStream()
|
||||||
self.comp.stream_class = MockStream
|
self.comp.stream_class = MockStream
|
||||||
account.hub.threadConnection = connectionForURI('sqlite://' + DB_URL)
|
account.hub.threadConnection = connectionForURI('sqlite://' + DB_URL)
|
||||||
|
|||||||
Reference in New Issue
Block a user