summaryrefslogtreecommitdiff
path: root/tests/test_stream_presence.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-10-26 23:47:17 -0400
committerLance Stout <lancestout@gmail.com>2010-10-26 23:47:17 -0400
commit65aa6573df3a8f298e7df96473014c19216971ef (patch)
treed9a40d480071bd5e1983f3de41aa1860be1baa98 /tests/test_stream_presence.py
parentb888610525a441dce622bf6132a4b3cab76a26b2 (diff)
downloadslixmpp-65aa6573df3a8f298e7df96473014c19216971ef.tar.gz
slixmpp-65aa6573df3a8f298e7df96473014c19216971ef.tar.bz2
slixmpp-65aa6573df3a8f298e7df96473014c19216971ef.tar.xz
slixmpp-65aa6573df3a8f298e7df96473014c19216971ef.zip
First pass at integrating the new roster manager.
Diffstat (limited to 'tests/test_stream_presence.py')
-rw-r--r--tests/test_stream_presence.py34
1 files changed, 25 insertions, 9 deletions
diff --git a/tests/test_stream_presence.py b/tests/test_stream_presence.py
index ca67f1df..c873799a 100644
--- a/tests/test_stream_presence.py
+++ b/tests/test_stream_presence.py
@@ -30,7 +30,9 @@ class TestStreamPresence(SleekTest):
self.xmpp.add_event_handler('presence_unavailable', unavailable)
self.stream_recv("""
- <presence type="unavailable" from="otheruser@localhost" />
+ <presence from="otheruser@localhost"
+ to="tester@localhost"
+ type="unavailable" />
""")
# Give event queue time to process.
@@ -68,12 +70,14 @@ class TestStreamPresence(SleekTest):
# Contact comes online.
self.stream_recv("""
- <presence from="otheruser@localhost/foobar" />
+ <presence from="otheruser@localhost/foobar"
+ to="tester@localhost" />
""")
# Contact goes offline, should trigger got_offline.
self.stream_recv("""
<presence from="otheruser@localhost/foobar"
+ to="tester@localhost"
type="unavailable" />
""")
@@ -99,7 +103,8 @@ class TestStreamPresence(SleekTest):
self.xmpp.add_event_handler('got_online', got_online)
self.stream_recv("""
- <presence from="user@localhost" />
+ <presence from="user@localhost"
+ to="tester@localhost" />
""")
# Give event queue time to process.
@@ -136,15 +141,23 @@ class TestStreamPresence(SleekTest):
self.xmpp.auto_subscribe = True
self.stream_recv("""
- <presence from="user@localhost" type="subscribe" />
+ <presence from="user@localhost"
+ to="tester@localhost"
+ type="subscribe" />
+ """)
+
+ self.stream_send_presence("""
+ <presence to="user@localhost"
+ type="subscribed" />
""")
self.stream_send_presence("""
- <presence to="user@localhost" type="subscribed" />
+ <presence to="user@localhost" />
""")
self.stream_send_presence("""
- <presence to="user@localhost" type="subscribe" />
+ <presence to="user@localhost"
+ type="subscribe" />
""")
expected = set(('presence_subscribe', 'changed_subscription'))
@@ -170,14 +183,17 @@ class TestStreamPresence(SleekTest):
presence_subscribe)
# With this setting we should reject all subscriptions.
- self.xmpp.auto_authorize = False
+ self.xmpp.rosters['tester@localhost'].auto_authorize = False
self.stream_recv("""
- <presence from="user@localhost" type="subscribe" />
+ <presence from="user@localhost"
+ to="tester@localhost"
+ type="subscribe" />
""")
self.stream_send_presence("""
- <presence to="user@localhost" type="unsubscribed" />
+ <presence to="user@localhost"
+ type="unsubscribed" />
""")
expected = set(('presence_subscribe', 'changed_subscription'))