diff options
author | Lance Stout <lancestout@gmail.com> | 2010-08-26 18:27:18 -0400 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2010-08-26 18:27:18 -0400 |
commit | 37ff17b0cbefd8a0056b131621728123b292e211 (patch) | |
tree | 001725e30ffc8f7886bc8a748838452e1809790a /tests/test_elementbase.py | |
parent | 00d7952001ce82e4c89699970dee38f29f4c7419 (diff) | |
download | slixmpp-37ff17b0cbefd8a0056b131621728123b292e211.tar.gz slixmpp-37ff17b0cbefd8a0056b131621728123b292e211.tar.bz2 slixmpp-37ff17b0cbefd8a0056b131621728123b292e211.tar.xz slixmpp-37ff17b0cbefd8a0056b131621728123b292e211.zip |
Added unit test for _fix_ns for handling namespaces with forward slashes.
Diffstat (limited to 'tests/test_elementbase.py')
-rw-r--r-- | tests/test_elementbase.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_elementbase.py b/tests/test_elementbase.py index 6b0c076b..8de7a169 100644 --- a/tests/test_elementbase.py +++ b/tests/test_elementbase.py @@ -3,6 +3,21 @@ from sleekxmpp.xmlstream.stanzabase import ElementBase class TestElementBase(SleekTest): + def testFixNs(self): + """Test fixing namespaces in an XPath expression.""" + + e = ElementBase() + ns = "http://jabber.org/protocol/disco#items" + result = e._fix_ns("{%s}foo/bar/{abc}baz/{%s}more" % (ns, ns)) + + expected = "/".join(["{%s}foo" % ns, + "{%s}bar" % ns, + "{abc}baz", + "{%s}more" % ns]) + self.failUnless(expected == result, + "Incorrect namespace fixing result: %s" % str(result)) + + def testExtendedName(self): """Test element names of the form tag1/tag2/tag3.""" |