diff options
author | Lance Stout <lancestout@gmail.com> | 2011-09-01 09:27:10 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-09-01 09:27:10 -0700 |
commit | 002257b8208e343661a68710a3ee936067bfdba0 (patch) | |
tree | d8fb649f623e2020dcd339ee94763dd3f86fb259 /tests | |
parent | 0af35c2224889a06e5ac25028ee5b489106d201b (diff) | |
download | slixmpp-002257b8208e343661a68710a3ee936067bfdba0.tar.gz slixmpp-002257b8208e343661a68710a3ee936067bfdba0.tar.bz2 slixmpp-002257b8208e343661a68710a3ee936067bfdba0.tar.xz slixmpp-002257b8208e343661a68710a3ee936067bfdba0.zip |
Add tests for retrieving pubsub items.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_stream_xep_0060.py | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/tests/test_stream_xep_0060.py b/tests/test_stream_xep_0060.py index 4e2dca6d..0ac7d9fc 100644 --- a/tests/test_stream_xep_0060.py +++ b/tests/test_stream_xep_0060.py @@ -478,19 +478,69 @@ class TestStreamPubsub(SleekTest): def testGetItem(self): """Test retrieving a single item.""" - pass + self.xmpp['xep_0060'].get_item( + 'pubsub.example.com', + 'somenode', + 'id42', + block=False) + self.send(""" + <iq type="get" id="1" to="pubsub.example.com"> + <pubsub xmlns="http://jabber.org/protocol/pubsub"> + <items node="somenode"> + <item id="id42" /> + </items> + </pubsub> + </iq> + """) def testGetLatestItems(self): """Test retrieving the most recent N items.""" - pass + self.xmpp['xep_0060'].get_items( + 'pubsub.example.com', + 'somenode', + max_items=3, + block=False) + self.send(""" + <iq type="get" id="1" to="pubsub.example.com"> + <pubsub xmlns="http://jabber.org/protocol/pubsub"> + <items node="somenode" max_items="3" /> + </pubsub> + </iq> + """) def testGetAllItems(self): """Test retrieving all items.""" - pass + self.xmpp['xep_0060'].get_items( + 'pubsub.example.com', + 'somenode', + block=False) + self.send(""" + <iq type="get" id="1" to="pubsub.example.com"> + <pubsub xmlns="http://jabber.org/protocol/pubsub"> + <items node="somenode" /> + </pubsub> + </iq> + """) def testGetSpecificItems(self): """Test retrieving a specific set of items.""" - pass + self.xmpp['xep_0060'].get_items( + 'pubsub.example.com', + 'somenode', + item_ids=['A', 'B', 'C'], + block=False) + self.send(""" + <iq type="get" id="1" to="pubsub.example.com"> + <pubsub xmlns="http://jabber.org/protocol/pubsub"> + <items node="somenode"> + <item id="A" /> + <item id="B" /> + <item id="C" /> + </items> + </pubsub> + </iq> + """) + suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamPubsub) |