summaryrefslogtreecommitdiff
path: root/tests/test_stream_roster.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-05-20 17:42:40 -0400
committerLance Stout <lancestout@gmail.com>2011-05-20 17:42:40 -0400
commitc49a8e91142121251ccb2cacd3b3f0d5cd78db97 (patch)
treeeb48fa075fd45993e4ee97c303eb4a5c2710bd2f /tests/test_stream_roster.py
parentd3bd9cd31d3cbf99d02539ecf4d3de20eafb8c8a (diff)
downloadslixmpp-c49a8e91142121251ccb2cacd3b3f0d5cd78db97.tar.gz
slixmpp-c49a8e91142121251ccb2cacd3b3f0d5cd78db97.tar.bz2
slixmpp-c49a8e91142121251ccb2cacd3b3f0d5cd78db97.tar.xz
slixmpp-c49a8e91142121251ccb2cacd3b3f0d5cd78db97.zip
Save progress
Diffstat (limited to 'tests/test_stream_roster.py')
-rw-r--r--tests/test_stream_roster.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/test_stream_roster.py b/tests/test_stream_roster.py
index 28d07b51..f557e8b2 100644
--- a/tests/test_stream_roster.py
+++ b/tests/test_stream_roster.py
@@ -1,3 +1,5 @@
+# -*- encoding:utf8 -*-
+
from sleekxmpp.test import *
import time
import threading
@@ -158,5 +160,49 @@ 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 from="andré@foo/bar" />
+ """)
+
+ # Give the event queue time to process.
+ time.sleep(.1)
+
+ roster = {'andré@foo': {
+ 'name': '',
+ 'subscription': 'both',
+ 'groups': ['Unicode'],
+ 'presence': {
+ 'bar':{'priority':0,
+ 'status':'',
+ 'show':'available'}},
+ 'in_roster': True}}
+ self.failUnless(self.xmpp.roster == roster,
+ "Unexpected roster values: %s" % self.xmpp.roster)
+
suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamRoster)