From 181aea737d5bce9479795b58c29b5a92da3bd48b Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 5 Jun 2012 16:54:26 -0700 Subject: Add initial support for xml:lang for streams and stanza plugins. Remaining items are suitable default actions for language supporting interfaces. --- sleekxmpp/test/sleektest.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sleekxmpp/test') diff --git a/sleekxmpp/test/sleektest.py b/sleekxmpp/test/sleektest.py index ba79dce8..92a7688a 100644 --- a/sleekxmpp/test/sleektest.py +++ b/sleekxmpp/test/sleektest.py @@ -333,6 +333,9 @@ class SleekTest(unittest.TestCase): # Remove unique ID prefix to make it easier to test self.xmpp._id_prefix = '' self.xmpp._disconnect_wait_for_threads = False + self.xmpp.default_lang = None + self.xmpp.peer_default_lang = None + # We will use this to wait for the session_start event # for live connections. @@ -386,6 +389,7 @@ class SleekTest(unittest.TestCase): sid='', stream_ns="http://etherx.jabber.org/streams", default_ns="jabber:client", + default_lang="en", version="1.0", xml_header=True): """ @@ -413,6 +417,8 @@ class SleekTest(unittest.TestCase): parts.append('from="%s"' % sfrom) if sid: parts.append('id="%s"' % sid) + if default_lang: + parts.append('xml:lang="%s"' % default_lang) parts.append('version="%s"' % version) parts.append('xmlns:stream="%s"' % stream_ns) parts.append('xmlns="%s"' % default_ns) @@ -564,6 +570,7 @@ class SleekTest(unittest.TestCase): sid='', stream_ns="http://etherx.jabber.org/streams", default_ns="jabber:client", + default_lang="en", version="1.0", xml_header=False, timeout=1): @@ -585,6 +592,7 @@ class SleekTest(unittest.TestCase): header = self.make_header(sto, sfrom, sid, stream_ns=stream_ns, default_ns=default_ns, + default_lang=default_lang, version=version, xml_header=xml_header) sent_header = self.xmpp.socket.next_sent(timeout) -- cgit v1.2.3 From d92aa05b5c18806ab5addc947eeedaaf4d51500e Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 19 Jun 2012 01:29:48 -0700 Subject: PEP8 formatting updates. --- sleekxmpp/test/sleektest.py | 1 - 1 file changed, 1 deletion(-) (limited to 'sleekxmpp/test') diff --git a/sleekxmpp/test/sleektest.py b/sleekxmpp/test/sleektest.py index 92a7688a..7a3bef24 100644 --- a/sleekxmpp/test/sleektest.py +++ b/sleekxmpp/test/sleektest.py @@ -336,7 +336,6 @@ class SleekTest(unittest.TestCase): self.xmpp.default_lang = None self.xmpp.peer_default_lang = None - # We will use this to wait for the session_start event # for live connections. skip_queue = queue.Queue() -- cgit v1.2.3 From 7858d969d82eaaa7124b8d59a68c286f06cbf758 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 19 Jun 2012 09:47:31 -0700 Subject: Remove usage of deprecated getchildren() method. --- sleekxmpp/test/sleektest.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sleekxmpp/test') diff --git a/sleekxmpp/test/sleektest.py b/sleekxmpp/test/sleektest.py index 7a3bef24..cac99f77 100644 --- a/sleekxmpp/test/sleektest.py +++ b/sleekxmpp/test/sleektest.py @@ -76,7 +76,7 @@ class SleekTest(unittest.TestCase): known_prefixes[prefix], xml_string) xml = self.parse_xml(xml_string) - xml = xml.getchildren()[0] + xml = list(xml)[0] return xml else: self.fail("XML data was mal-formed:\n%s" % xml_string) @@ -517,9 +517,9 @@ class SleekTest(unittest.TestCase): if '{%s}lang' % xml_ns in recv_xml.attrib: del recv_xml.attrib['{%s}lang' % xml_ns] - if recv_xml.getchildren: + if list(recv_xml): # We received more than just the header - for xml in recv_xml.getchildren(): + for xml in recv_xml: self.xmpp.socket.recv_data(tostring(xml)) attrib = recv_xml.attrib @@ -698,7 +698,7 @@ class SleekTest(unittest.TestCase): if xml.tag.startswith('{'): return xml.tag = '{%s}%s' % (ns, xml.tag) - for child in xml.getchildren(): + for child in xml: self.fix_namespaces(child, ns) def compare(self, xml, *other): @@ -741,7 +741,7 @@ class SleekTest(unittest.TestCase): return False # Step 4: Check children count - if len(xml.getchildren()) != len(other.getchildren()): + if len(list(xml)) != len(list(other)): return False # Step 5: Recursively check children -- cgit v1.2.3