2 from slixmpp
.test
import SlixTest
3 from slixmpp
.plugins
.xep_0059
import Set
4 from slixmpp
.xmlstream
import ET
7 class TestSetStanzas(SlixTest
):
9 def testSetFirstIndex(self
):
12 s
.set_first_index('10')
14 <set xmlns="http://jabber.org/protocol/rsm">
15 <first index="10">id</first>
19 def testGetFirstIndex(self
):
21 <set xmlns="http://jabber.org/protocol/rsm">
22 <first index="10">id</first>
25 s
= Set(ET
.fromstring(xml_string
))
27 self
.failUnless(s
['first_index'] == expected
)
29 def testDelFirstIndex(self
):
31 <set xmlns="http://jabber.org/protocol/rsm">
32 <first index="10">id</first>
35 s
= Set(ET
.fromstring(xml_string
))
38 <set xmlns="http://jabber.org/protocol/rsm">
43 def testSetBefore(self
):
47 <set xmlns="http://jabber.org/protocol/rsm">
52 def testGetBefore(self
):
54 <set xmlns="http://jabber.org/protocol/rsm">
58 s
= Set(ET
.fromstring(xml_string
))
60 self
.failUnless(s
['before'] == expected
)
62 def testGetBefore(self
):
64 <set xmlns="http://jabber.org/protocol/rsm">
68 s
= Set(ET
.fromstring(xml_string
))
71 <set xmlns="http://jabber.org/protocol/rsm">
75 def testSetBeforeVal(self
):
79 <set xmlns="http://jabber.org/protocol/rsm">
84 def testGetBeforeVal(self
):
86 <set xmlns="http://jabber.org/protocol/rsm">
90 s
= Set(ET
.fromstring(xml_string
))
92 self
.failUnless(s
['before'] == expected
)
94 def testGetBeforeVal(self
):
96 <set xmlns="http://jabber.org/protocol/rsm">
100 s
= Set(ET
.fromstring(xml_string
))
103 <set xmlns="http://jabber.org/protocol/rsm">
108 suite
= unittest
.TestLoader().loadTestsFromTestCase(TestSetStanzas
)