From a8e36574873e86d75a5ca796ce212c10dd3266ff Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sat, 8 Jan 2011 10:58:47 -0500 Subject: Added new XEP-0059 plugin. Contributed by Erik Reuterborg Larsson (who). --- tests/test_stanza_xep_0059.py | 106 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 tests/test_stanza_xep_0059.py (limited to 'tests/test_stanza_xep_0059.py') diff --git a/tests/test_stanza_xep_0059.py b/tests/test_stanza_xep_0059.py new file mode 100644 index 00000000..913436a6 --- /dev/null +++ b/tests/test_stanza_xep_0059.py @@ -0,0 +1,106 @@ +from sleekxmpp.test import * +from sleekxmpp.plugins.xep_0059 import Set + + +class TestSetStanzas(SleekTest): + + def testSetFirstIndex(self): + s = Set() + s['first'] = 'id' + s.set_first_index('10') + self.check(s, """ + + id + + """) + + def testGetFirstIndex(self): + xml_string = """ + + id + + """ + s = Set(ET.fromstring(xml_string)) + expected = '10' + self.failUnless(s['first_index'] == expected) + + def testDelFirstIndex(self): + xml_string = """ + + id + + """ + s = Set(ET.fromstring(xml_string)) + del s['first_index'] + self.check(s, """ + + id + + """) + + def testSetBefore(self): + s = Set() + s['before'] = True + self.check(s, """ + + + + """) + + def testGetBefore(self): + xml_string = """ + + + + """ + s = Set(ET.fromstring(xml_string)) + expected = True + self.failUnless(s['before'] == expected) + + def testGetBefore(self): + xml_string = """ + + + + """ + s = Set(ET.fromstring(xml_string)) + del s['before'] + self.check(s, """ + + + """) + + def testSetBeforeVal(self): + s = Set() + s['before'] = 'id' + self.check(s, """ + + id + + """) + + def testGetBeforeVal(self): + xml_string = """ + + id + + """ + s = Set(ET.fromstring(xml_string)) + expected = 'id' + self.failUnless(s['before'] == expected) + + def testGetBeforeVal(self): + xml_string = """ + + id + + """ + s = Set(ET.fromstring(xml_string)) + del s['before'] + self.check(s, """ + + + """) + + +suite = unittest.TestLoader().loadTestsFromTestCase(TestSetStanzas) -- cgit v1.2.3