summaryrefslogtreecommitdiff
path: root/tests/test_stream_roster.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2013-03-28 12:20:38 -0700
committerLance Stout <lancestout@gmail.com>2013-03-28 12:20:38 -0700
commit0a2737dc77709daa0196340368b7ffbfaf71f641 (patch)
tree087efc13f84b19e4c0b6820f7956eeac0fd3784c /tests/test_stream_roster.py
parent8b73c2bcff14fbda4b2549f167047a7ca1187fa8 (diff)
parent481971928c972a96a114b6dcf6480e48b530d95b (diff)
downloadslixmpp-0a2737dc77709daa0196340368b7ffbfaf71f641.tar.gz
slixmpp-0a2737dc77709daa0196340368b7ffbfaf71f641.tar.bz2
slixmpp-0a2737dc77709daa0196340368b7ffbfaf71f641.tar.xz
slixmpp-0a2737dc77709daa0196340368b7ffbfaf71f641.zip
Merge pull request #228 from anton-ryzhov/events
Some events refactoring
Diffstat (limited to 'tests/test_stream_roster.py')
-rw-r--r--tests/test_stream_roster.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/tests/test_stream_roster.py b/tests/test_stream_roster.py
index 652ea1ce..3d1447a3 100644
--- a/tests/test_stream_roster.py
+++ b/tests/test_stream_roster.py
@@ -19,16 +19,9 @@ class TestStreamRoster(SleekTest):
"""Test handling roster requests."""
self.stream_start(mode='client', jid='tester@localhost')
- events = []
-
- def roster_received(iq):
- events.append('roster_received')
+ roster_updates = []
- 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)
+ self.xmpp.add_event_handler('roster_update', roster_updates.append)
# Since get_roster blocks, we need to run it in a thread.
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.
time.sleep(.1)
- self.failUnless(events == ['roster_received', 'roster_update'],
- "Wrong roster events fired: %s" % events)
+ self.failUnless(len(roster_updates) == 1,
+ "Wrong number of roster_update events fired: %s (should be 1)" % len(roster_updates))
def testRosterSet(self):
"""Test handling pushed roster updates."""
@@ -156,7 +149,7 @@ class TestStreamRoster(SleekTest):
"""Test rejecting a roster push from an unauthorized source."""
self.stream_start()
self.recv("""
- <iq to='tester@localhost' from="malicious_user@localhost"
+ <iq to='tester@localhost' from="malicious_user@localhost"
type="set" id="1">
<query xmlns="jabber:iq:roster">
<item jid="user@localhost"