mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
Added unit test for _fix_ns for handling namespaces with forward slashes.
This commit is contained in:
parent
00d7952001
commit
37ff17b0cb
1 changed files with 15 additions and 0 deletions
|
@ -3,6 +3,21 @@ from sleekxmpp.xmlstream.stanzabase import ElementBase
|
||||||
|
|
||||||
class TestElementBase(SleekTest):
|
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):
|
def testExtendedName(self):
|
||||||
"""Test element names of the form tag1/tag2/tag3."""
|
"""Test element names of the form tag1/tag2/tag3."""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue