summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-08-19 19:11:12 -0400
committerLance Stout <lancestout@gmail.com>2010-08-19 19:11:12 -0400
commitfac3bca1f6fd2412b52c3e7ce9b0971d8a290083 (patch)
treec6f47b2998c01799aea3df34b3824f3eda3f913d /tests
parente4240dd593207a5912de996c42451b3946f113b2 (diff)
downloadslixmpp-fac3bca1f6fd2412b52c3e7ce9b0971d8a290083.tar.gz
slixmpp-fac3bca1f6fd2412b52c3e7ce9b0971d8a290083.tar.bz2
slixmpp-fac3bca1f6fd2412b52c3e7ce9b0971d8a290083.tar.xz
slixmpp-fac3bca1f6fd2412b52c3e7ce9b0971d8a290083.zip
Updated ElementBase.__delitem__ and added unit tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_elementbase.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/test_elementbase.py b/tests/test_elementbase.py
index 95502f54..bf86e599 100644
--- a/tests/test_elementbase.py
+++ b/tests/test_elementbase.py
@@ -189,5 +189,46 @@ class TestElementBase(SleekTest):
</foo>
""")
+ def testDelItem(self):
+ """Test deleting stanza interface values."""
+
+ class TestStanza(ElementBase):
+ name = "foo"
+ namespace = "foo"
+ interfaces = set(('bar', 'baz', 'qux'))
+ sub_interfaces = set(('bar',))
+
+ def delQux(self):
+ pass
+
+ class TestStanzaPlugin(ElementBase):
+ name = "foobar"
+ namespace = "foo"
+ plugin_attrib = "foobar"
+ interfaces = set(('foobar',))
+
+ registerStanzaPlugin(TestStanza, TestStanzaPlugin)
+
+ stanza = TestStanza()
+ stanza['bar'] = 'a'
+ stanza['baz'] = 'b'
+ stanza['qux'] = 'c'
+ stanza['foobar']['foobar'] = 'd'
+
+ self.checkStanza(TestStanza, stanza, """
+ <foo xmlns="foo" baz="b" qux="c">
+ <bar>a</bar>
+ <foobar foobar="d" />
+ </foo>
+ """)
+
+ del stanza['bar']
+ del stanza['baz']
+ del stanza['qux']
+ del stanza['foobar']
+
+ self.checkStanza(TestStanza, stanza, """
+ <foo xmlns="foo" qux="c" />
+ """)
suite = unittest.TestLoader().loadTestsFromTestCase(TestElementBase)