annotate sat/test/test_plugin_misc_groupblog.py @ 2668:c274201cea94

core, frontends (xmlui): added "hidden" widget, to specify a value to be returned unmodified
author Goffi <goffi@goffi.org>
date Fri, 31 Aug 2018 15:57:11 +0200
parents 56f94936df1e
children 378188abe941
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1934
2daf7b4c6756 use of /usr/bin/env instead of /usr/bin/python in shebang
Goffi <goffi@goffi.org>
parents: 1910
diff changeset
1 #!/usr/bin/env python2
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
3
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
4 # SAT: a jabber client
2483
0046283a285d dates update
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
5 # Copyright (C) 2009-2018 Jérôme Poisson (goffi@goffi.org)
1766
d17772b0fe22 copyright update
Goffi <goffi@goffi.org>
parents: 1425
diff changeset
6 # Copyright (C) 2013-2016 Adrien Cossa (souliane@mailoo.org)
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
7
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
8 # This program is free software: you can redistribute it and/or modify
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
9 # it under the terms of the GNU Affero General Public License as published by
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
10 # the Free Software Foundation, either version 3 of the License, or
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
11 # (at your option) any later version.
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
12
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
13 # This program is distributed in the hope that it will be useful,
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
16 # GNU Affero General Public License for more details.
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
17
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
18 # You should have received a copy of the GNU Affero General Public License
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
20
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
21 """ Plugin groupblogs """
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
22
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
23 from constants import Const as C
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
24 from sat.test import helpers, helpers_plugins
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
25 from sat.plugins import plugin_misc_groupblog
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
26 from sat.plugins import plugin_xep_0060
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
27 from sat.plugins import plugin_xep_0277
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
28 from sat.plugins import plugin_xep_0163
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
29 from sat.plugins import plugin_misc_text_syntaxes
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
30 from twisted.internet import defer
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
31 from twisted.words.protocols.jabber import jid
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
32
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
33
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
34 NS_PUBSUB = "http://jabber.org/protocol/pubsub"
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
35
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
36 DO_NOT_COUNT_COMMENTS = -1
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
37
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
38 SERVICE = u"pubsub.example.com"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
39 PUBLISHER = u"test@example.org"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
40 OTHER_PUBLISHER = u"other@xmpp.net"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
41 NODE_ID = u"urn:xmpp:groupblog:{publisher}".format(publisher=PUBLISHER)
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
42 OTHER_NODE_ID = u"urn:xmpp:groupblog:{publisher}".format(publisher=OTHER_PUBLISHER)
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
43 ITEM_ID_1 = u"c745a688-9b02-11e3-a1a3-c0143dd4fe51"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
44 COMMENT_ID_1 = u"d745a688-9b02-11e3-a1a3-c0143dd4fe52"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
45 COMMENT_ID_2 = u"e745a688-9b02-11e3-a1a3-c0143dd4fe53"
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
46
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
47
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
48 def COMMENTS_NODE_ID(publisher=PUBLISHER):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
49 return u"urn:xmpp:comments:_{id}__urn:xmpp:groupblog:{publisher}".format(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
50 id=ITEM_ID_1, publisher=publisher
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
51 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
52
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
53
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
54 def COMMENTS_NODE_URL(publisher=PUBLISHER):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
55 return u"xmpp:{service}?node={node}".format(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
56 service=SERVICE,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
57 id=ITEM_ID_1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
58 node=COMMENTS_NODE_ID(publisher).replace(":", "%3A").replace("@", "%40"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
59 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
60
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
61
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
62 def ITEM(publisher=PUBLISHER):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
63 return u"""
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
64 <item id='{id}' xmlns='{ns}'>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
65 <entry>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
66 <title type='text'>The Uses of This World</title>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
67 <id>{id}</id>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
68 <updated>2003-12-12T17:47:23Z</updated>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
69 <published>2003-12-12T17:47:23Z</published>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
70 <link href='{comments_node_url}' rel='replies' title='comments'/>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
71 <author>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
72 <name>{publisher}</name>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
73 </author>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
74 </entry>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
75 </item>
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
76 """.format(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
77 ns=NS_PUBSUB,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
78 id=ITEM_ID_1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
79 publisher=publisher,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
80 comments_node_url=COMMENTS_NODE_URL(publisher),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
81 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
82
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
83
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
84 def COMMENT(id_=COMMENT_ID_1):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
85 return u"""
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
86 <item id='{id}' xmlns='{ns}'>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
87 <entry>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
88 <title type='text'>The Uses of This World</title>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
89 <id>{id}</id>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
90 <updated>2003-12-12T17:47:23Z</updated>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
91 <published>2003-12-12T17:47:23Z</published>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
92 <author>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
93 <name>{publisher}</name>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
94 </author>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
95 </entry>
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
96 </item>
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
97 """.format(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
98 ns=NS_PUBSUB, id=id_, publisher=PUBLISHER
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
99 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
100
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
101
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
102 def ITEM_DATA(id_=ITEM_ID_1, count=0):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
103 res = {
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
104 "id": ITEM_ID_1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
105 "type": "main_item",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
106 "content": "The Uses of This World",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
107 "author": PUBLISHER,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
108 "updated": "1071251243.0",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
109 "published": "1071251243.0",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
110 "service": SERVICE,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
111 "comments": COMMENTS_NODE_URL_1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
112 "comments_service": SERVICE,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
113 "comments_node": COMMENTS_NODE_ID_1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
114 }
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
115 if count != DO_NOT_COUNT_COMMENTS:
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
116 res.update({"comments_count": unicode(count)})
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
117 return res
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
118
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
119
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
120 def COMMENT_DATA(id_=COMMENT_ID_1):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
121 return {
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
122 "id": id_,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
123 "type": "comment",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
124 "content": "The Uses of This World",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
125 "author": PUBLISHER,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
126 "updated": "1071251243.0",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
127 "published": "1071251243.0",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
128 "service": SERVICE,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
129 "node": COMMENTS_NODE_ID_1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
130 "verified_publisher": "false",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
131 }
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
132
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
133
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
134 COMMENTS_NODE_ID_1 = COMMENTS_NODE_ID()
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
135 COMMENTS_NODE_ID_2 = COMMENTS_NODE_ID(OTHER_PUBLISHER)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
136 COMMENTS_NODE_URL_1 = COMMENTS_NODE_URL()
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
137 COMMENTS_NODE_URL_2 = COMMENTS_NODE_URL(OTHER_PUBLISHER)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
138 ITEM_1 = ITEM()
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
139 ITEM_2 = ITEM(OTHER_PUBLISHER)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
140 COMMENT_1 = COMMENT(COMMENT_ID_1)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
141 COMMENT_2 = COMMENT(COMMENT_ID_2)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
142
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
143
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
144 def ITEM_DATA_1(count=0):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
145 return ITEM_DATA(count=count)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
146
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
147
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
148 COMMENT_DATA_1 = COMMENT_DATA()
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
149 COMMENT_DATA_2 = COMMENT_DATA(COMMENT_ID_2)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
150
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
151
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
152 class XEP_groupblogTest(helpers.SatTestCase):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
153 def setUp(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
154 self.host = helpers.FakeSAT()
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
155 self.host.plugins["XEP-0060"] = plugin_xep_0060.XEP_0060(self.host)
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
156 self.host.plugins["XEP-0163"] = plugin_xep_0163.XEP_0163(self.host)
1910
55440ee00905 test: update some tests
souliane <souliane@mailoo.org>
parents: 1766
diff changeset
157 reload(plugin_misc_text_syntaxes) # reload the plugin to avoid conflict error
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
158 self.host.plugins["TEXT-SYNTAXES"] = plugin_misc_text_syntaxes.TextSyntaxes(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
159 self.host
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
160 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
161 self.host.plugins["XEP-0277"] = plugin_xep_0277.XEP_0277(self.host)
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
162 self.plugin = plugin_misc_groupblog.GroupBlog(self.host)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
163 self.plugin._initialise = self._initialise
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
164 self.__initialised = False
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
165 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
166
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
167 def _initialise(self, profile_key):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
168 profile = profile_key
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
169 client = self.host.getClient(profile)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
170 if not self.__initialised:
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
171 client.item_access_pubsub = jid.JID(SERVICE)
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
172 xep_0060 = self.host.plugins["XEP-0060"]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
173 client.pubsub_client = helpers_plugins.FakeSatPubSubClient(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
174 self.host, xep_0060
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
175 )
1424
2d8fccec84e8 core (tests): test fixes
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
176 client.pubsub_client.parent = client
2d8fccec84e8 core (tests): test fixes
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
177 self.psclient = client.pubsub_client
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
178 helpers.FakeSAT.getDiscoItems = self.psclient.service_getDiscoItems
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
179 self.__initialised = True
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
180 return defer.succeed((profile, client))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
181
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
182 def _addItem(self, profile, item, parent_node=None):
1424
2d8fccec84e8 core (tests): test fixes
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
183 client = self.host.getClient(profile)
2d8fccec84e8 core (tests): test fixes
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
184 client.pubsub_client._addItem(item, parent_node)
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
185
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
186 def test_sendGroupBlog(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
187 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
188 d = self.psclient.items(SERVICE, NODE_ID)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
189 d.addCallback(lambda items: self.assertEqual(len(items), 0))
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
190 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
191 lambda dummy: self.plugin.sendGroupBlog(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
192 "PUBLIC", [], "test", {}, C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
193 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
194 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
195 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
196 return d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
197
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
198 def test_deleteGroupBlog(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
199 pub_data = (SERVICE, NODE_ID, ITEM_ID_1)
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
200 self.host.bridge.expectCall(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
201 "personalEvent",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
202 C.JID_STR[0],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
203 "MICROBLOG_DELETE",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
204 {"type": "main_item", "id": ITEM_ID_1},
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
205 C.PROFILE[0],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
206 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
207
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
208 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
209 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
210 lambda dummy: self.plugin.deleteGroupBlog(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
211 pub_data, COMMENTS_NODE_URL_1, profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
212 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
213 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
214 return d.addCallback(self.assertEqual, None)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
215
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
216 def test_updateGroupBlog(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
217 pub_data = (SERVICE, NODE_ID, ITEM_ID_1)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
218 new_text = u"silfu23RFWUP)IWNOEIOEFÖ"
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
219
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
220 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
221 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
222 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
223 lambda dummy: self.plugin.updateGroupBlog(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
224 pub_data, COMMENTS_NODE_URL_1, new_text, {}, profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
225 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
226 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
227 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
228 return d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
229 lambda items: self.assertEqual(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
230 "".join(items[0].entry.title.children), new_text
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
231 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
232 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
233
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
234 def test_sendGroupBlogComment(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
235 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
236 d = self.psclient.items(SERVICE, NODE_ID)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
237 d.addCallback(lambda items: self.assertEqual(len(items), 0))
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
238 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
239 lambda dummy: self.plugin.sendGroupBlogComment(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
240 COMMENTS_NODE_URL_1, "test", {}, profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
241 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
242 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
243 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
244 return d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
245
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
246 def test_getGroupBlogs(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
247 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
248 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
249 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
250 lambda dummy: self.plugin.getGroupBlogs(PUBLISHER, profile_key=C.PROFILE[0])
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
251 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
252 result = (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
253 [ITEM_DATA_1()],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
254 {"count": "1", "index": "0", "first": ITEM_ID_1, "last": ITEM_ID_1},
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
255 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
256 return d.addCallback(self.assertEqual, result)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
257
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
258 def test_getGroupBlogsNoCount(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
259 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
260 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
261 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
262 lambda dummy: self.plugin.getGroupBlogs(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
263 PUBLISHER, count_comments=False, profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
264 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
265 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
266 result = (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
267 [ITEM_DATA_1(DO_NOT_COUNT_COMMENTS)],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
268 {"count": "1", "index": "0", "first": ITEM_ID_1, "last": ITEM_ID_1},
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
269 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
270 return d.addCallback(self.assertEqual, result)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
271
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
272 def test_getGroupBlogsWithIDs(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
273 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
274 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
275 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
276 lambda dummy: self.plugin.getGroupBlogs(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
277 PUBLISHER, [ITEM_ID_1], profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
278 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
279 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
280 result = (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
281 [ITEM_DATA_1()],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
282 {"count": "1", "index": "0", "first": ITEM_ID_1, "last": ITEM_ID_1},
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
283 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
284 return d.addCallback(self.assertEqual, result)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
285
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
286 def test_getGroupBlogsWithRSM(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
287 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
288 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
289 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
290 lambda dummy: self.plugin.getGroupBlogs(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
291 PUBLISHER, rsm_data={"max_": 1}, profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
292 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
293 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
294 result = (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
295 [ITEM_DATA_1()],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
296 {"count": "1", "index": "0", "first": ITEM_ID_1, "last": ITEM_ID_1},
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
297 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
298 return d.addCallback(self.assertEqual, result)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
299
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
300 def test_getGroupBlogsWithComments(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
301 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
302 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
303 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
304 lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1])
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
305 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
306 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
307 lambda dummy: self.plugin.getGroupBlogsWithComments(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
308 PUBLISHER, [], profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
309 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
310 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
311 result = (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
312 [
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
313 (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
314 ITEM_DATA_1(1),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
315 (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
316 [COMMENT_DATA_1],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
317 {
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
318 "count": "1",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
319 "index": "0",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
320 "first": COMMENT_ID_1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
321 "last": COMMENT_ID_1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
322 },
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
323 ),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
324 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
325 ],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
326 {"count": "1", "index": "0", "first": ITEM_ID_1, "last": ITEM_ID_1},
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
327 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
328 return d.addCallback(self.assertEqual, result)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
329
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
330 def test_getGroupBlogsWithComments2(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
331 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
332 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
333 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
334 lambda dummy: self.psclient.publish(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
335 SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
336 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
337 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
338 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
339 lambda dummy: self.plugin.getGroupBlogsWithComments(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
340 PUBLISHER, [], profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
341 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
342 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
343 result = (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
344 [
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
345 (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
346 ITEM_DATA_1(2),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
347 (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
348 [COMMENT_DATA_1, COMMENT_DATA_2],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
349 {
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
350 "count": "2",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
351 "index": "0",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
352 "first": COMMENT_ID_1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
353 "last": COMMENT_ID_2,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
354 },
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
355 ),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
356 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
357 ],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
358 {"count": "1", "index": "0", "first": ITEM_ID_1, "last": ITEM_ID_1},
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
359 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
360
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
361 return d.addCallback(self.assertEqual, result)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
362
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
363 def test_getGroupBlogsAtom(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
364 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
365 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
366 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
367 lambda dummy: self.plugin.getGroupBlogsAtom(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
368 PUBLISHER, {"max_": 1}, profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
369 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
370 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
371
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
372 def cb(atom):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
373 self.assertIsInstance(atom, unicode)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
374 self.assertTrue(atom.startswith('<?xml version="1.0" encoding="utf-8"?>'))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
375
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
376 return d.addCallback(cb)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
377
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
378 def test_getMassiveGroupBlogs(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
379 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
380 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
381 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
382 lambda dummy: self.plugin.getMassiveGroupBlogs(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
383 "JID", [jid.JID(PUBLISHER)], {"max_": 1}, profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
384 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
385 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
386 result = {
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
387 PUBLISHER: (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
388 [ITEM_DATA_1()],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
389 {"count": "1", "index": "0", "first": ITEM_ID_1, "last": ITEM_ID_1},
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
390 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
391 }
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
392
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
393 def clean(res):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
394 del self.host.plugins["XEP-0060"].node_cache[
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
395 C.PROFILE[0] + "@found@" + SERVICE
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
396 ]
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
397 return res
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
398
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
399 d.addCallback(clean)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
400 d.addCallback(self.assertEqual, result)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
401
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
402 def test_getMassiveGroupBlogsWithComments(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
403 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
404 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
405 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
406 lambda dummy: self.psclient.publish(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
407 SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
408 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
409 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
410 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
411 lambda dummy: self.plugin.getMassiveGroupBlogs(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
412 "JID", [jid.JID(PUBLISHER)], {"max_": 1}, profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
413 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
414 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
415 result = {
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
416 PUBLISHER: (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
417 [ITEM_DATA_1(2)],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
418 {"count": "1", "index": "0", "first": ITEM_ID_1, "last": ITEM_ID_1},
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
419 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
420 }
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
421
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
422 def clean(res):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
423 del self.host.plugins["XEP-0060"].node_cache[
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
424 C.PROFILE[0] + "@found@" + SERVICE
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
425 ]
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
426 return res
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
427
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
428 d.addCallback(clean)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
429 d.addCallback(self.assertEqual, result)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
430
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
431 def test_getGroupBlogComments(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
432 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
433 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
434 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
435 lambda dummy: self.psclient.publish(SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1])
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
436 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
437 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
438 lambda dummy: self.plugin.getGroupBlogComments(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
439 SERVICE, COMMENTS_NODE_ID_1, {"max_": 1}, profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
440 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
441 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
442 result = (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
443 [COMMENT_DATA_1],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
444 {"count": "1", "index": "0", "first": COMMENT_ID_1, "last": COMMENT_ID_1},
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
445 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
446 return d.addCallback(self.assertEqual, result)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
447
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
448 def test_subscribeGroupBlog(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
449 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
450 d = self.plugin.subscribeGroupBlog(PUBLISHER, profile_key=C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
451 return d.addCallback(self.assertEqual, None)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
452
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
453 def test_massiveSubscribeGroupBlogs(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
454 self._initialise(C.PROFILE[0])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
455 d = self.plugin.massiveSubscribeGroupBlogs(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
456 "JID", [jid.JID(PUBLISHER)], profile_key=C.PROFILE[0]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
457 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
458
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
459 def clean(res):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
460 del self.host.plugins["XEP-0060"].node_cache[
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
461 C.PROFILE[0] + "@found@" + SERVICE
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
462 ]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
463 del self.host.plugins["XEP-0060"].node_cache[
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
464 C.PROFILE[0] + "@subscriptions@" + SERVICE
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
465 ]
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
466 return res
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
467
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
468 d.addCallback(clean)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
469 return d.addCallback(self.assertEqual, None)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
470
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
471 def test_deleteAllGroupBlogs(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
472 """Delete our main node and associated comments node"""
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
473 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
474 self.host.profiles[C.PROFILE[0]].roster.addItem(jid.JID(OTHER_PUBLISHER))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
475 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
476 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
477 lambda dummy: self.psclient.publish(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
478 SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
479 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
480 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
481 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
482 d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
483 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
484 d.addCallback(lambda items: self.assertEqual(len(items), 2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
485
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
486 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
487 lambda dummy: self.psclient.publish(SERVICE, OTHER_NODE_ID, [ITEM_2])
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
488 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
489 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
490 lambda dummy: self.psclient.publish(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
491 SERVICE, COMMENTS_NODE_ID_2, [COMMENT_1, COMMENT_2]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
492 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
493 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
494 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
495 d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
496 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
497 d.addCallback(lambda items: self.assertEqual(len(items), 2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
498
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
499 def clean(res):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
500 del self.host.plugins["XEP-0060"].node_cache[
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
501 C.PROFILE[0] + "@found@" + SERVICE
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
502 ]
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
503 return res
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
504
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
505 d.addCallback(lambda dummy: self.plugin.deleteAllGroupBlogs(C.PROFILE[0]))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
506 d.addCallback(clean)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
507
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
508 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
509 d.addCallback(lambda items: self.assertEqual(len(items), 0))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
510 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
511 d.addCallback(lambda items: self.assertEqual(len(items), 0))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
512
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
513 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
514 d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
515 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
516 d.addCallback(lambda items: self.assertEqual(len(items), 2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
517 return d
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
518
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
519 def test_deleteAllGroupBlogsComments(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
520 """Delete the comments we posted on other node's"""
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
521 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
522 self.host.profiles[C.PROFILE[0]].roster.addItem(jid.JID(OTHER_PUBLISHER))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
523 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
524 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
525 lambda dummy: self.psclient.publish(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
526 SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
527 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
528 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
529 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
530 d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
531 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
532 d.addCallback(lambda items: self.assertEqual(len(items), 2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
533
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
534 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
535 lambda dummy: self.psclient.publish(SERVICE, OTHER_NODE_ID, [ITEM_2])
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
536 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
537 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
538 lambda dummy: self.psclient.publish(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
539 SERVICE, COMMENTS_NODE_ID_2, [COMMENT_1, COMMENT_2]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
540 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
541 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
542 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
543 d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
544 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
545 d.addCallback(lambda items: self.assertEqual(len(items), 2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
546
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
547 def clean(res):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
548 del self.host.plugins["XEP-0060"].node_cache[
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
549 C.PROFILE[0] + "@found@" + SERVICE
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
550 ]
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
551 return res
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
552
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
553 d.addCallback(lambda dummy: self.plugin.deleteAllGroupBlogsComments(C.PROFILE[0]))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
554 d.addCallback(clean)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
555
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
556 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
557 d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
558 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
559 d.addCallback(lambda items: self.assertEqual(len(items), 2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
560
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
561 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
562 d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
563 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
564 d.addCallback(lambda items: self.assertEqual(len(items), 0))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
565 return d
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
566
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
567 def test_deleteAllGroupBlogsAndComments(self):
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
568 self._initialise(C.PROFILE[0])
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
569 self.host.profiles[C.PROFILE[0]].roster.addItem(jid.JID(OTHER_PUBLISHER))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
570 d = self.psclient.publish(SERVICE, NODE_ID, [ITEM_1])
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
571 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
572 lambda dummy: self.psclient.publish(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
573 SERVICE, COMMENTS_NODE_ID_1, [COMMENT_1, COMMENT_2]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
574 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
575 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
576 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
577 d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
578 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
579 d.addCallback(lambda items: self.assertEqual(len(items), 2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
580
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
581 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
582 lambda dummy: self.psclient.publish(SERVICE, OTHER_NODE_ID, [ITEM_2])
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
583 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
584 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
585 lambda dummy: self.psclient.publish(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
586 SERVICE, COMMENTS_NODE_ID_2, [COMMENT_1, COMMENT_2]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
587 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
588 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
589 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
590 d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
591 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
592 d.addCallback(lambda items: self.assertEqual(len(items), 2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
593
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
594 def clean(res):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
595 del self.host.plugins["XEP-0060"].node_cache[
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
596 C.PROFILE[0] + "@found@" + SERVICE
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
597 ]
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
598 return res
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
599
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
600 d.addCallback(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
601 lambda dummy: self.plugin.deleteAllGroupBlogsAndComments(C.PROFILE[0])
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
602 )
1269
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
603 d.addCallback(clean)
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
604
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
605 d.addCallback(lambda dummy: self.psclient.items(SERVICE, NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
606 d.addCallback(lambda items: self.assertEqual(len(items), 0))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
607 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
608 d.addCallback(lambda items: self.assertEqual(len(items), 0))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
609
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
610 d.addCallback(lambda dummy: self.psclient.items(SERVICE, OTHER_NODE_ID))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
611 d.addCallback(lambda items: self.assertEqual(len(items), 1))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
612 d.addCallback(lambda dummy: self.psclient.items(SERVICE, COMMENTS_NODE_ID_2))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
613 d.addCallback(lambda items: self.assertEqual(len(items), 0))
91e5becc6623 test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
diff changeset
614 return d