Fixed ElementBase.match to respect namespaces.
This commit is contained in:
@@ -433,7 +433,7 @@ class TestElementBase(SleekTest):
|
||||
|
||||
class TestSubStanza(ElementBase):
|
||||
name = "sub"
|
||||
namespace = "foo"
|
||||
namespace = "baz"
|
||||
interfaces = set(('attrib',))
|
||||
|
||||
class TestStanza(ElementBase):
|
||||
@@ -444,7 +444,7 @@ class TestElementBase(SleekTest):
|
||||
|
||||
class TestStanzaPlugin(ElementBase):
|
||||
name = "plugin"
|
||||
namespace = "foo"
|
||||
namespace = "bar"
|
||||
interfaces = set(('attrib',))
|
||||
|
||||
registerStanzaPlugin(TestStanza, TestStanzaPlugin)
|
||||
@@ -453,6 +453,9 @@ class TestElementBase(SleekTest):
|
||||
self.failUnless(stanza.match("foo"),
|
||||
"Stanza did not match its own tag name.")
|
||||
|
||||
self.failUnless(stanza.match("{foo}foo"),
|
||||
"Stanza did not match its own namespaced name.")
|
||||
|
||||
stanza['bar'] = 'a'
|
||||
self.failUnless(stanza.match("foo@bar=a"),
|
||||
"Stanza did not match its own name with attribute value check.")
|
||||
@@ -465,11 +468,17 @@ class TestElementBase(SleekTest):
|
||||
self.failUnless(stanza.match("foo/plugin@attrib=c"),
|
||||
"Stanza did not match with plugin and attribute.")
|
||||
|
||||
self.failUnless(stanza.match("foo/{bar}plugin"),
|
||||
"Stanza did not match with namespaced plugin.")
|
||||
|
||||
substanza = TestSubStanza()
|
||||
substanza['attrib'] = 'd'
|
||||
stanza.append(substanza)
|
||||
self.failUnless(stanza.match("foo/sub@attrib=d"),
|
||||
"Stanza did not match with substanzas and attribute.")
|
||||
|
||||
self.failUnless(stanza.match("foo/{baz}sub"),
|
||||
"Stanza did not match with namespaced substanza.")
|
||||
|
||||
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestElementBase)
|
||||
|
||||
Reference in New Issue
Block a user