comparison src/test/test_plugin_misc_groupblog.py @ 1269:91e5becc6623

test: add tests for plugin_misc_groupblog
author souliane <souliane@mailoo.org>
date Mon, 15 Dec 2014 14:05:28 +0100
parents
children 069ad98b360d
comparison
equal deleted inserted replaced
1268:bb30bf3ae932 1269:91e5becc6623
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # SAT: a jabber client
5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jérôme Poisson (goffi@goffi.org)
6 # Copyright (C) 2013, 2014 Adrien Cossa (souliane@mailoo.org)
7
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Affero General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Affero General Public License for more details.
17
18 # You should have received a copy of the GNU Affero General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21 """ Plugin groupblogs """
22
23 from constants import Const as C
24 from sat.test import helpers, helpers_plugins
25 from sat.plugins import plugin_misc_groupblog
26 from sat.plugins import plugin_xep_0060
27 from sat.plugins import plugin_xep_0277
28 from sat.plugins import plugin_xep_0163
29 from sat.plugins import plugin_misc_text_syntaxes
30 from twisted.internet import defer
31 from twisted.words.protocols.jabber import jid
32
33
34 NS_PUBSUB = 'http://jabber.org/protocol/pubsub'
35
36 DO_NOT_COUNT_COMMENTS = -1
37
38 SERVICE = u'pubsub.example.com'
39 PUBLISHER = u'test@example.org'
40 OTHER_PUBLISHER = u'other@xmpp.net'
41 NODE_ID = u'urn:xmpp:groupblog:{publisher}'.format(publisher=PUBLISHER)
42 OTHER_NODE_ID = u'urn:xmpp:groupblog:{publisher}'.format(publisher=OTHER_PUBLISHER)
43 ITEM_ID_1 = u'c745a688-9b02-11e3-a1a3-c0143dd4fe51'
44 COMMENT_ID_1 = u'd745a688-9b02-11e3-a1a3-c0143dd4fe52'
45 COMMENT_ID_2 = u'e745a688-9b02-11e3-a1a3-c0143dd4fe53'
46
47
48 def COMMENTS_NODE_ID(publisher=PUBLISHER):
49 return u'urn:xmpp:comments:_{id}__urn:xmpp:groupblog:{publisher}'.format(id=ITEM_ID_1, publisher=publisher)
50
51
52 def COMMENTS_NODE_URL(publisher=PUBLISHER):
53 return u'xmpp:{service}?node={node}'.format(service=SERVICE, id=ITEM_ID_1,
54 node=COMMENTS_NODE_ID(publisher).replace(':', '%3A').replace('@', '%40'))
55
56
57 def ITEM(publisher=PUBLISHER):
58 return u"""
59 <item id='{id}' xmlns='{ns}'>
60 <entry>
61 <title type='text'>The Uses of This World</title>
62 <id>{id}</id>
63 <updated>2003-12-12T17:47:23Z</updated>
64 <published>2003-12-12T17:47:23Z</published>
65 <link href='{comments_node_url}' rel='replies' title='comments'/>
66 <author>
67 <name>{publisher}</name>
68 </author>
69 </entry>
70 </item>
71 """.format(ns=NS_PUBSUB, id=ITEM_ID_1, publisher=publisher, comments_node_url=COMMENTS_NODE_URL(publisher))
72
73
74 def COMMENT(id_=COMMENT_ID_1):
75 return u"""
76 <item id='{id}' xmlns='{ns}'>
77 <entry>
78 <title type='text'>The Uses of This World</title>
79 <id>{id}</id>
80 <updated>2003-12-12T17:47:23Z</updated>
81 <published>2003-12-12T17:47:23Z</published>
82 <author>
83 <name>{publisher}</name>
84 </author>
85 </entry>
86 </item>
87 """.format(ns=NS_PUBSUB, id=id_, publisher=PUBLISHER)
88
89
90 def ITEM_DATA(id_=ITEM_ID_1, count=0):
91 res = {'id': ITEM_ID_1,
92 'type': 'main_item',
93 'content': 'The Uses of This World',
94 'author': PUBLISHER,
95 'updated': '1071251243.0',
96 'published': '1071251243.0',
97 'service': SERVICE,
98 'comments': COMMENTS_NODE_URL_1,
99 'comments_service': SERVICE,
100 'comments_node': COMMENTS_NODE_ID_1}
101 if count != DO_NOT_COUNT_COMMENTS:
102 res.update({'comments_count': unicode(count)})
103 return res
104
105
106 def COMMENT_DATA(id_=COMMENT_ID_1):
107 return {'id': id_,
108 'type': 'comment',
109 'content': 'The Uses of This World',
110 'author': PUBLISHER,
111 'updated': '1071251243.0',
112 'published': '1071251243.0',
113 'service': SERVICE,
114 'node': COMMENTS_NODE_ID_1,
115 'verified_publisher': 'false'}
116
117
118 COMMENTS_NODE_ID_1 = COMMENTS_NODE_ID()
119 COMMENTS_NODE_ID_2 = COMMENTS_NODE_ID(OTHER_PUBLISHER)
120 COMMENTS_NODE_URL_1 = COMMENTS_NODE_URL()
121 COMMENTS_NODE_URL_2 = COMMENTS_NODE_URL(OTHER_PUBLISHER)
122 ITEM_1 = ITEM()
123 ITEM_2 = ITEM(OTHER_PUBLISHER)
124 COMMENT_1 = COMMENT(COMMENT_ID_1)
125 COMMENT_2 = COMMENT(COMMENT_ID_2)
126
127
128 def ITEM_DATA_1(count=0):
129 return ITEM_DATA(count=count)
130
131 COMMENT_DATA_1 = COMMENT_DATA()
132 COMMENT_DATA_2 = COMMENT_DATA(COMMENT_ID_2)
133
134
135 class XEP_groupblogTest(helpers.SatTestCase):
136
137 def setUp(self):
138 self.host = helpers.FakeSAT()
139 self.plugin = plugin_misc_groupblog.GroupBlog(self.host)
140 self.plugin._initialise = self._initialise
141 self.host.plugins['XEP-0060'] = plugin_xep_0060.XEP_0060(self.host)
142 self.host.plugins['XEP-0163'] = plugin_xep_0163.XEP_0163(self.host)
143 self.host.plugins['TEXT-SYNTAXES'] = plugin_misc_text_syntaxes.TextSyntaxes(self.host)
144 self.host.plugins['XEP-0277'] = plugin_xep_0277.XEP_0277(self.host)
145 self.__initialised = False
146 self._initialise(C.PROFILE[0])
147
148 def _initialise(self, profile_key):
149 profile = profile_key
150 client = self.host.getClient(profile)
151 if not self.__initialised:
152 client.item_access_pubsub = jid.JID(SERVICE)
153 xep_0060 = self.host.plugins['XEP-0060']
154 xep_0060.clients[profile] = helpers_plugins.FakeSatPubSubClient(self.host, xep_0060)
155 xep_0060.clients[profile].parent = client
156 self.psclient = xep_0060.clients[profile]
157 helpers.FakeSAT.getDiscoItems = self.psclient.service_getDiscoItems
158 self.__initialised = True
159 return defer.succeed((profile, client))
160
161 def _addItem(self, profile, item, parent_node=None):
162 self.host.plugins['XEP-0060'].clients[profile]._addItem(item, parent_node)
163
164 def test_sendGroupBlog(self):
165 self._initialise(C.PROFILE[0])
166 d = self.psclient.items(SERVICE, NODE_ID)
167 d.addCallback(lambda items: self.assertEqual(len(items), 0))
168 d.addCallback(lambda dummy: self.plugin.sendGroupBlog('PUBLIC', [], 'test', {}, C.PROFILE[0]))
169 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
170 return d.addCallback(lambda items: self.assertEqual(len(items), 1))
171
172 def test_deleteGroupBlog(self):
173 pub_data = (SERVICE, NODE_ID, ITEM_ID_1)
174 self.host.bridge.expectCall('personalEvent', C.JID_STR[0],
175 "MICROBLOG_DELETE",
176 {'type': 'main_item', 'id': ITEM_ID_1},
177 C.PROFILE[0])
178
179 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
180 d.addCallback(lambda dummy: self.plugin.deleteGroupBlog(pub_data, COMMENTS_NODE_URL_1, profile_key=C.PROFILE[0]))
181 return d.addCallback(self.assertEqual, None)
182
183 def test_updateGroupBlog(self):
184 pub_data = (SERVICE, NODE_ID, ITEM_ID_1)
185 new_text = u"silfu23RFWUP)IWNOEIOEFÖ"
186
187 self._initialise(C.PROFILE[0])
188 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
189 d.addCallback(lambda dummy: self.plugin.updateGroupBlog(pub_data, COMMENTS_NODE_URL_1, new_text, {}, profile_key=C.PROFILE[0]))
190 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
191 return d.addCallback(lambda items: self.assertEqual(''.join(items[0].entry.title.children), new_text))
192
193 def test_sendGroupBlogComment(self):
194 self._initialise(C.PROFILE[0])
195 d = self.psclient.items(SERVICE, NODE_ID)
196 d.addCallback(lambda items: self.assertEqual(len(items), 0))
197 d.addCallback(lambda dummy: self.plugin.sendGroupBlogComment(COMMENTS_NODE_URL_1, 'test', {}, profile_key=C.PROFILE[0]))
198 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
199 return d.addCallback(lambda items: self.assertEqual(len(items), 1))
200
201 def test_getGroupBlogs(self):
202 self._initialise(C.PROFILE[0])
203 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
204 d.addCallback(lambda dummy: self.plugin.getGroupBlogs(PUBLISHER, profile_key=C.PROFILE[0]))
205 result = ([ITEM_DATA_1()], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})
206 return d.addCallback(self.assertEqual, result)
207
208 def test_getGroupBlogsNoCount(self):
209 self._initialise(C.PROFILE[0])
210 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
211 d.addCallback(lambda dummy: self.plugin.getGroupBlogs(PUBLISHER, count_comments=False, profile_key=C.PROFILE[0]))
212 result = ([ITEM_DATA_1(DO_NOT_COUNT_COMMENTS)], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})
213 return d.addCallback(self.assertEqual, result)
214
215 def test_getGroupBlogsWithIDs(self):
216 self._initialise(C.PROFILE[0])
217 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
218 d.addCallback(lambda dummy: self.plugin.getGroupBlogs(PUBLISHER, [ITEM_ID_1], profile_key=C.PROFILE[0]))
219 result = ([ITEM_DATA_1()], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})
220 return d.addCallback(self.assertEqual, result)
221
222 def test_getGroupBlogsWithRSM(self):
223 self._initialise(C.PROFILE[0])
224 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
225 d.addCallback(lambda dummy: self.plugin.getGroupBlogs(PUBLISHER, rsm={'max': 1}, profile_key=C.PROFILE[0]))
226 result = ([ITEM_DATA_1()], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})
227 return d.addCallback(self.assertEqual, result)
228
229 def test_getGroupBlogsWithComments(self):
230 self._initialise(C.PROFILE[0])
231 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
232 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1]))
233 d.addCallback(lambda dummy: self.plugin.getGroupBlogsWithComments(PUBLISHER, [], profile_key=C.PROFILE[0]))
234 result = ([(ITEM_DATA_1(1), ([COMMENT_DATA_1],
235 {'count': '1', 'index': '0', 'first': COMMENT_ID_1, 'last': COMMENT_ID_1}))],
236 {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})
237 return d.addCallback(self.assertEqual, result)
238
239 def test_getGroupBlogsWithComments2(self):
240 self._initialise(C.PROFILE[0])
241 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
242 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2]))
243 d.addCallback(lambda dummy: self.plugin.getGroupBlogsWithComments(PUBLISHER, [], profile_key=C.PROFILE[0]))
244 result = ([(ITEM_DATA_1(2), ([COMMENT_DATA_1, COMMENT_DATA_2],
245 {'count': '2', 'index': '0', 'first': COMMENT_ID_1, 'last': COMMENT_ID_2}))],
246 {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})
247
248 return d.addCallback(self.assertEqual, result)
249
250 def test_getGroupBlogsAtom(self):
251 self._initialise(C.PROFILE[0])
252 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
253 d.addCallback(lambda dummy: self.plugin.getGroupBlogsAtom(PUBLISHER, {'max': 1}, profile_key=C.PROFILE[0]))
254
255 def cb(atom):
256 self.assertIsInstance(atom, unicode)
257 self.assertTrue(atom.startswith('<?xml version="1.0" encoding="utf-8"?>'))
258
259 return d.addCallback(cb)
260
261 def test_getMassiveGroupBlogs(self):
262 self._initialise(C.PROFILE[0])
263 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
264 d.addCallback(lambda dummy: self.plugin.getMassiveGroupBlogs('JID', [jid.JID(PUBLISHER)], {'max': 1}, profile_key=C.PROFILE[0]))
265 result = {PUBLISHER: ([ITEM_DATA_1()], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})}
266
267 def clean(res):
268 del self.host.plugins['XEP-0060'].node_cache[C.PROFILE[0] + '@found@' + SERVICE]
269 return res
270
271 d.addCallback(clean)
272 d.addCallback(self.assertEqual, result)
273
274 def test_getMassiveGroupBlogsWithComments(self):
275 self._initialise(C.PROFILE[0])
276 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
277 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2]))
278 d.addCallback(lambda dummy: self.plugin.getMassiveGroupBlogs('JID', [jid.JID(PUBLISHER)], {'max': 1}, profile_key=C.PROFILE[0]))
279 result = {PUBLISHER: ([ITEM_DATA_1(2)], {'count': '1', 'index': '0', 'first': ITEM_ID_1, 'last': ITEM_ID_1})}
280
281 def clean(res):
282 del self.host.plugins['XEP-0060'].node_cache[C.PROFILE[0] + '@found@' + SERVICE]
283 return res
284
285 d.addCallback(clean)
286 d.addCallback(self.assertEqual, result)
287
288 def test_getGroupBlogComments(self):
289 self._initialise(C.PROFILE[0])
290 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
291 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1]))
292 d.addCallback(lambda dummy: self.plugin.getGroupBlogComments(SERVICE, COMMENTS_NODE_ID_1, {'max': 1}, profile_key=C.PROFILE[0]))
293 result = ([COMMENT_DATA_1], {'count': '1', 'index': '0', 'first': COMMENT_ID_1, 'last': COMMENT_ID_1})
294 return d.addCallback(self.assertEqual, result)
295
296 def test_subscribeGroupBlog(self):
297 self._initialise(C.PROFILE[0])
298 d = self.plugin.subscribeGroupBlog(PUBLISHER, profile_key=C.PROFILE[0])
299 return d.addCallback(self.assertEqual, None)
300
301 def test_massiveSubscribeGroupBlogs(self):
302 self._initialise(C.PROFILE[0])
303 d = self.plugin.massiveSubscribeGroupBlogs('JID', [jid.JID(PUBLISHER)], profile_key=C.PROFILE[0])
304
305 def clean(res):
306 del self.host.plugins['XEP-0060'].node_cache[C.PROFILE[0] + '@found@' + SERVICE]
307 del self.host.plugins['XEP-0060'].node_cache[C.PROFILE[0] + '@subscriptions@' + SERVICE]
308 return res
309
310 d.addCallback(clean)
311 return d.addCallback(self.assertEqual, None)
312
313 def test_deleteAllGroupBlogs(self):
314 """Delete our main node and associated comments node"""
315 self._initialise(C.PROFILE[0])
316 self.host.profiles[C.PROFILE[0]].roster.addItem(jid.JID(OTHER_PUBLISHER))
317 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
318 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2]))
319 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
320 d.addCallback(lambda items: self.assertEqual(len(items), 1))
321 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
322 d.addCallback(lambda items: self.assertEqual(len(items), 2))
323
324 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, OTHER_NODE_ID, [ITEM_2]))
325 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_2, [COMMENT_1, COMMENT_2]))
326 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
327 d.addCallback(lambda items: self.assertEqual(len(items), 1))
328 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
329 d.addCallback(lambda items: self.assertEqual(len(items), 2))
330
331 def clean(res):
332 del self.host.plugins['XEP-0060'].node_cache[C.PROFILE[0] + '@found@' + SERVICE]
333 return res
334
335 d.addCallback(lambda dummy: self.plugin.deleteAllGroupBlogs(C.PROFILE[0]))
336 d.addCallback(clean)
337
338 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
339 d.addCallback(lambda items: self.assertEqual(len(items), 0))
340 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
341 d.addCallback(lambda items: self.assertEqual(len(items), 0))
342
343 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
344 d.addCallback(lambda items: self.assertEqual(len(items), 1))
345 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
346 d.addCallback(lambda items: self.assertEqual(len(items), 2))
347 return d
348
349 def test_deleteAllGroupBlogsComments(self):
350 """Delete the comments we posted on other node's"""
351 self._initialise(C.PROFILE[0])
352 self.host.profiles[C.PROFILE[0]].roster.addItem(jid.JID(OTHER_PUBLISHER))
353 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
354 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2]))
355 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
356 d.addCallback(lambda items: self.assertEqual(len(items), 1))
357 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
358 d.addCallback(lambda items: self.assertEqual(len(items), 2))
359
360 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, OTHER_NODE_ID, [ITEM_2]))
361 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_2, [COMMENT_1, COMMENT_2]))
362 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
363 d.addCallback(lambda items: self.assertEqual(len(items), 1))
364 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
365 d.addCallback(lambda items: self.assertEqual(len(items), 2))
366
367 def clean(res):
368 del self.host.plugins['XEP-0060'].node_cache[C.PROFILE[0] + '@found@' + SERVICE]
369 return res
370
371 d.addCallback(lambda dummy: self.plugin.deleteAllGroupBlogsComments(C.PROFILE[0]))
372 d.addCallback(clean)
373
374 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
375 d.addCallback(lambda items: self.assertEqual(len(items), 1))
376 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
377 d.addCallback(lambda items: self.assertEqual(len(items), 2))
378
379 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
380 d.addCallback(lambda items: self.assertEqual(len(items), 1))
381 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
382 d.addCallback(lambda items: self.assertEqual(len(items), 0))
383 return d
384
385 def test_deleteAllGroupBlogsAndComments(self):
386 self._initialise(C.PROFILE[0])
387 self.host.profiles[C.PROFILE[0]].roster.addItem(jid.JID(OTHER_PUBLISHER))
388 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
389 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2]))
390 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
391 d.addCallback(lambda items: self.assertEqual(len(items), 1))
392 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
393 d.addCallback(lambda items: self.assertEqual(len(items), 2))
394
395 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, OTHER_NODE_ID, [ITEM_2]))
396 d.addCallback(lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_2, [COMMENT_1, COMMENT_2]))
397 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
398 d.addCallback(lambda items: self.assertEqual(len(items), 1))
399 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
400 d.addCallback(lambda items: self.assertEqual(len(items), 2))
401
402 def clean(res):
403 del self.host.plugins['XEP-0060'].node_cache[C.PROFILE[0] + '@found@' + SERVICE]
404 return res
405
406 d.addCallback(lambda dummy: self.plugin.deleteAllGroupBlogsAndComments(C.PROFILE[0]))
407 d.addCallback(clean)
408
409 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
410 d.addCallback(lambda items: self.assertEqual(len(items), 0))
411 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
412 d.addCallback(lambda items: self.assertEqual(len(items), 0))
413
414 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
415 d.addCallback(lambda items: self.assertEqual(len(items), 1))
416 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
417 d.addCallback(lambda items: self.assertEqual(len(items), 0))
418 return d