Mercurial > libervia-backend
comparison src/test/test_plugin_misc_groupblog.py @ 1425:7f8af1e69812
core (tests): fixed bad use of reserved name
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 23 Apr 2015 15:16:06 +0200 |
parents | 2d8fccec84e8 |
children | d17772b0fe22 |
comparison
equal
deleted
inserted
replaced
1424:2d8fccec84e8 | 1425:7f8af1e69812 |
---|---|
221 return d.addCallback(self.assertEqual, result) | 221 return d.addCallback(self.assertEqual, result) |
222 | 222 |
223 def test_getGroupBlogsWithRSM(self): | 223 def test_getGroupBlogsWithRSM(self): |
224 self._initialise(C.PROFILE[0]) | 224 self._initialise(C.PROFILE[0]) |
225 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1]) | 225 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1]) |
226 d.addCallback(lambda dummy: self.plugin.getGroupBlogs(PUBLISHER, rsm={'max': 1}, profile_key=C.PROFILE[0])) | 226 d.addCallback(lambda dummy: self.plugin.getGroupBlogs(PUBLISHER, rsm_data={'max_': 1}, profile_key=C.PROFILE[0])) |
227 result = ([ITEM_DATA_1()], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1}) | 227 result = ([ITEM_DATA_1()], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1}) |
228 return d.addCallback(self.assertEqual, result) | 228 return d.addCallback(self.assertEqual, result) |
229 | 229 |
230 def test_getGroupBlogsWithComments(self): | 230 def test_getGroupBlogsWithComments(self): |
231 self._initialise(C.PROFILE[0]) | 231 self._initialise(C.PROFILE[0]) |
249 return d.addCallback(self.assertEqual, result) | 249 return d.addCallback(self.assertEqual, result) |
250 | 250 |
251 def test_getGroupBlogsAtom(self): | 251 def test_getGroupBlogsAtom(self): |
252 self._initialise(C.PROFILE[0]) | 252 self._initialise(C.PROFILE[0]) |
253 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1]) | 253 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1]) |
254 d.addCallback(lambda dummy: self.plugin.getGroupBlogsAtom(PUBLISHER, {'max': 1}, profile_key=C.PROFILE[0])) | 254 d.addCallback(lambda dummy: self.plugin.getGroupBlogsAtom(PUBLISHER, {'max_': 1}, profile_key=C.PROFILE[0])) |
255 | 255 |
256 def cb(atom): | 256 def cb(atom): |
257 self.assertIsInstance(atom, unicode) | 257 self.assertIsInstance(atom, unicode) |
258 self.assertTrue(atom.startswith('<?xml version="1.0" encoding="utf-8"?>')) | 258 self.assertTrue(atom.startswith('<?xml version="1.0" encoding="utf-8"?>')) |
259 | 259 |
260 return d.addCallback(cb) | 260 return d.addCallback(cb) |
261 | 261 |
262 def test_getMassiveGroupBlogs(self): | 262 def test_getMassiveGroupBlogs(self): |
263 self._initialise(C.PROFILE[0]) | 263 self._initialise(C.PROFILE[0]) |
264 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1]) | 264 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1]) |
265 d.addCallback(lambda dummy: self.plugin.getMassiveGroupBlogs('JID', [jid.JID(PUBLISHER)], {'max': 1}, profile_key=C.PROFILE[0])) | 265 d.addCallback(lambda dummy: self.plugin.getMassiveGroupBlogs('JID', [jid.JID(PUBLISHER)], {'max_': 1}, profile_key=C.PROFILE[0])) |
266 result = {PUBLISHER: ([ITEM_DATA_1()], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})} | 266 result = {PUBLISHER: ([ITEM_DATA_1()], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})} |
267 | 267 |
268 def clean(res): | 268 def clean(res): |
269 del self.host.plugins['XEP-0060'].node_cache[C.PROFILE[0] + '@found@' + SERVICE] | 269 del self.host.plugins['XEP-0060'].node_cache[C.PROFILE[0] + '@found@' + SERVICE] |
270 return res | 270 return res |
274 | 274 |
275 def test_getMassiveGroupBlogsWithComments(self): | 275 def test_getMassiveGroupBlogsWithComments(self): |
276 self._initialise(C.PROFILE[0]) | 276 self._initialise(C.PROFILE[0]) |
277 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1]) | 277 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1]) |
278 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2])) | 278 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2])) |
279 d.addCallback(lambda dummy: self.plugin.getMassiveGroupBlogs('JID', [jid.JID(PUBLISHER)], {'max': 1}, profile_key=C.PROFILE[0])) | 279 d.addCallback(lambda dummy: self.plugin.getMassiveGroupBlogs('JID', [jid.JID(PUBLISHER)], {'max_': 1}, profile_key=C.PROFILE[0])) |
280 result = {PUBLISHER: ([ITEM_DATA_1(2)], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})} | 280 result = {PUBLISHER: ([ITEM_DATA_1(2)], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})} |
281 | 281 |
282 def clean(res): | 282 def clean(res): |
283 del self.host.plugins['XEP-0060'].node_cache[C.PROFILE[0] + '@found@' + SERVICE] | 283 del self.host.plugins['XEP-0060'].node_cache[C.PROFILE[0] + '@found@' + SERVICE] |
284 return res | 284 return res |
288 | 288 |
289 def test_getGroupBlogComments(self): | 289 def test_getGroupBlogComments(self): |
290 self._initialise(C.PROFILE[0]) | 290 self._initialise(C.PROFILE[0]) |
291 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1]) | 291 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1]) |
292 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1])) | 292 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1])) |
293 d.addCallback(lambda dummy: self.plugin.getGroupBlogComments(SERVICE, COMMENTS_NODE_ID_1, {'max': 1}, profile_key=C.PROFILE[0])) | 293 d.addCallback(lambda dummy: self.plugin.getGroupBlogComments(SERVICE, COMMENTS_NODE_ID_1, {'max_': 1}, profile_key=C.PROFILE[0])) |
294 result = ([COMMENT_DATA_1], {'count': '1', 'index': '0', 'first': COMMENT_ID_1, 'last': COMMENT_ID_1}) | 294 result = ([COMMENT_DATA_1], {'count': '1', 'index': '0', 'first': COMMENT_ID_1, 'last': COMMENT_ID_1}) |
295 return d.addCallback(self.assertEqual, result) | 295 return d.addCallback(self.assertEqual, result) |
296 | 296 |
297 def test_subscribeGroupBlog(self): | 297 def test_subscribeGroupBlog(self): |
298 self._initialise(C.PROFILE[0]) | 298 self._initialise(C.PROFILE[0]) |