Remove roster_received
event
This commit is contained in:
parent
01356d23e5
commit
c0d02d9935
2 changed files with 5 additions and 13 deletions
|
@ -248,7 +248,6 @@ class ClientXMPP(BaseXMPP):
|
||||||
callback = lambda resp: self._handle_roster(resp)
|
callback = lambda resp: self._handle_roster(resp)
|
||||||
|
|
||||||
response = iq.send(block, timeout, callback)
|
response = iq.send(block, timeout, callback)
|
||||||
self.event('roster_received', response)
|
|
||||||
|
|
||||||
if block:
|
if block:
|
||||||
self._handle_roster(response)
|
self._handle_roster(response)
|
||||||
|
|
|
@ -19,16 +19,9 @@ class TestStreamRoster(SleekTest):
|
||||||
"""Test handling roster requests."""
|
"""Test handling roster requests."""
|
||||||
self.stream_start(mode='client', jid='tester@localhost')
|
self.stream_start(mode='client', jid='tester@localhost')
|
||||||
|
|
||||||
events = []
|
roster_updates = []
|
||||||
|
|
||||||
def roster_received(iq):
|
self.xmpp.add_event_handler('roster_update', roster_updates.append)
|
||||||
events.append('roster_received')
|
|
||||||
|
|
||||||
def roster_update(iq):
|
|
||||||
events.append('roster_update')
|
|
||||||
|
|
||||||
self.xmpp.add_event_handler('roster_received', roster_received)
|
|
||||||
self.xmpp.add_event_handler('roster_update', roster_update)
|
|
||||||
|
|
||||||
# Since get_roster blocks, we need to run it in a thread.
|
# Since get_roster blocks, we need to run it in a thread.
|
||||||
t = threading.Thread(name='get_roster', target=self.xmpp.get_roster)
|
t = threading.Thread(name='get_roster', target=self.xmpp.get_roster)
|
||||||
|
@ -66,8 +59,8 @@ class TestStreamRoster(SleekTest):
|
||||||
# Give the event queue time to process.
|
# Give the event queue time to process.
|
||||||
time.sleep(.1)
|
time.sleep(.1)
|
||||||
|
|
||||||
self.failUnless(events == ['roster_received', 'roster_update'],
|
self.failUnless(len(roster_updates) == 1,
|
||||||
"Wrong roster events fired: %s" % events)
|
"Wrong number of roster_update events fired: %s (should be 1)" % len(roster_updates))
|
||||||
|
|
||||||
def testRosterSet(self):
|
def testRosterSet(self):
|
||||||
"""Test handling pushed roster updates."""
|
"""Test handling pushed roster updates."""
|
||||||
|
@ -156,7 +149,7 @@ class TestStreamRoster(SleekTest):
|
||||||
"""Test rejecting a roster push from an unauthorized source."""
|
"""Test rejecting a roster push from an unauthorized source."""
|
||||||
self.stream_start()
|
self.stream_start()
|
||||||
self.recv("""
|
self.recv("""
|
||||||
<iq to='tester@localhost' from="malicious_user@localhost"
|
<iq to='tester@localhost' from="malicious_user@localhost"
|
||||||
type="set" id="1">
|
type="set" id="1">
|
||||||
<query xmlns="jabber:iq:roster">
|
<query xmlns="jabber:iq:roster">
|
||||||
<item jid="user@localhost"
|
<item jid="user@localhost"
|
||||||
|
|
Loading…
Reference in a new issue