changeset 186:365fd3e4daf8

Add maxItems support.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 16 Apr 2008 14:14:27 +0000
parents 9038908dc2f5
children 69cdd8c6a431
files idavoll/gateway.py idavoll/test/test_gateway.py
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/idavoll/gateway.py	Tue Apr 15 17:32:56 2008 +0000
+++ b/idavoll/gateway.py	Wed Apr 16 14:14:27 2008 +0000
@@ -587,7 +587,7 @@
             return http.StatusResponse(responsecode.NOT_FOUND,
                                        "Node not found")
 
-        d = self.service.items(jid, nodeIdentifier)
+        d = self.service.items(jid, nodeIdentifier, maxItems)
         d.addCallback(respond)
         d.addErrback(trapNotFound)
         return d
@@ -722,7 +722,7 @@
     def items(self, xmppURI, maxItems=None):
         query = {'uri': xmppURI}
         if maxItems:
-             query['maxItems'] = int(maxItems)
+             query['max_items'] = int(maxItems)
         f = getPageWithFactory(self._makeURI('items', query),
                     method='GET',
                     agent=self.agent)
--- a/idavoll/test/test_gateway.py	Tue Apr 15 17:32:56 2008 +0000
+++ b/idavoll/test/test_gateway.py	Wed Apr 16 14:14:27 2008 +0000
@@ -149,16 +149,24 @@
         d.addCallback(cb)
         return d
 
+
     def test_items(self):
         def cb(response):
             xmppURI = response['uri']
             d = self.client.items(xmppURI)
             return d
 
-        def cb2(result):
-            return
+        d = self.client.publish(entry)
+        d.addCallback(cb)
+        return d
+
+
+    def test_itemsMaxItems(self):
+        def cb(response):
+            xmppURI = response['uri']
+            d = self.client.items(xmppURI, 2)
+            return d
 
         d = self.client.publish(entry)
         d.addCallback(cb)
-        d.addCallback(cb2)
         return d