summaryrefslogtreecommitdiff
path: root/tests/test_stream_roster.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-05-20 21:41:44 -0400
committerLance Stout <lancestout@gmail.com>2011-05-20 21:41:44 -0400
commit9851a2a057aeee54300f703a39507713e7ad199a (patch)
tree76056226ae21cef996b24da69534abfa08249d29 /tests/test_stream_roster.py
parenta269be485f2918b332c9fa3717541fc0c6c954c2 (diff)
parent7152d93dd05346fdb7dbe1893bff6395f83a79a9 (diff)
downloadslixmpp-9851a2a057aeee54300f703a39507713e7ad199a.tar.gz
slixmpp-9851a2a057aeee54300f703a39507713e7ad199a.tar.bz2
slixmpp-9851a2a057aeee54300f703a39507713e7ad199a.tar.xz
slixmpp-9851a2a057aeee54300f703a39507713e7ad199a.zip
Merge branch 'develop' into stream_features
Diffstat (limited to 'tests/test_stream_roster.py')
-rw-r--r--tests/test_stream_roster.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/test_stream_roster.py b/tests/test_stream_roster.py
index 731d1145..15b8683a 100644
--- a/tests/test_stream_roster.py
+++ b/tests/test_stream_roster.py
@@ -1,3 +1,7 @@
+# -*- encoding:utf-8 -*-
+
+from __future__ import unicode_literals
+
from sleekxmpp.test import *
import time
import threading
@@ -162,6 +166,53 @@ class TestStreamRoster(SleekTest):
self.failUnless(events == ['roster_callback'],
"Roster timeout event not triggered: %s." % events)
+ def testRosterUnicode(self):
+ """Test that JIDs with Unicode values are handled properly."""
+ self.stream_start()
+ self.recv("""
+ <iq to="tester@localhost" type="set" id="1">
+ <query xmlns="jabber:iq:roster">
+ <item jid="andré@foo" subscription="both">
+ <group>Unicode</group>
+ </item>
+ </query>
+ </iq>
+ """)
+
+ # Give the event queue time to process.
+ time.sleep(.1)
+
+ roster = {'andré@foo': {
+ 'name': '',
+ 'subscription': 'both',
+ 'groups': ['Unicode'],
+ 'presence': {},
+ 'in_roster': True}}
+ self.failUnless(self.xmpp.roster == roster,
+ "Unexpected roster values: %s" % self.xmpp.roster)
+
+ self.recv("""
+ <presence to="tester@localhost" from="andré@foo/bar">
+ <show>away</show>
+ <status>Testing</status>
+ </presence>
+ """)
+
+ # Give the event queue time to process.
+ time.sleep(.1)
+
+ roster = {'andré@foo': {
+ 'name': '',
+ 'subscription': 'both',
+ 'groups': ['Unicode'],
+ 'presence': {
+ 'bar':{'priority':0,
+ 'status':'Testing',
+ 'show':'away'}},
+ 'in_roster': True}}
+ self.failUnless(self.xmpp.roster == roster,
+ "Unexpected roster values: %s" % self.xmpp.roster)
+
suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamRoster)