Mercurial > libervia-backend
annotate sat/test/helpers_plugins.py @ 3013:860c550028d6
memory (sqlite): properly wait for messages to be writen in database:
the deferreds of the queries writing message to databases where not gathered and returned,
so the caller was not waiting for them to continue its workflow. This was resulting in
messages not always written when database was read just after the write (a case common
with MUC implementation), and message was appearing empty when sent to bridge.
fix 328
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 18 Jul 2019 21:58:34 +0200 |
parents | 003b8b4b56a7 |
children | ab2696e34d29 |
rev | line source |
---|---|
1934
2daf7b4c6756
use of /usr/bin/env instead of /usr/bin/python in shebang
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
1 #!/usr/bin/env python2 |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
3 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
4 # SAT: a jabber client |
2771 | 5 # Copyright (C) 2009-2019 Jérôme Poisson (goffi@goffi.org) |
1766 | 6 # Copyright (C) 2013-2016 Adrien Cossa (souliane@mailoo.org) |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
7 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
8 # This program is free software: you can redistribute it and/or modify |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
9 # it under the terms of the GNU Affero General Public License as published by |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
10 # the Free Software Foundation, either version 3 of the License, or |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
11 # (at your option) any later version. |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
12 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
13 # This program is distributed in the hope that it will be useful, |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
16 # GNU Affero General Public License for more details. |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
17 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
18 # You should have received a copy of the GNU Affero General Public License |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
19 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
20 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
21 """ Helpers class for plugin dependencies """ |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
22 |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
23 from twisted.internet import defer |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
24 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
25 from wokkel.muc import Room, User |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
26 from wokkel.generic import parseXml |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
27 from wokkel.disco import DiscoItem, DiscoItems |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
28 |
1270
037ec0795a85
test: fixes import for wokkel.rsm
souliane <souliane@mailoo.org>
parents:
1269
diff
changeset
|
29 # temporary until the changes are integrated to Wokkel |
2413
70399d1acb47
tmp: removed sat.tmp hierarchy and fixed references to it as it is now an independant sat_tmp repository
Goffi <goffi@goffi.org>
parents:
1934
diff
changeset
|
30 from sat_tmp.wokkel.rsm import RSMResponse |
1270
037ec0795a85
test: fixes import for wokkel.rsm
souliane <souliane@mailoo.org>
parents:
1269
diff
changeset
|
31 |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
32 from constants import Const as C |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
33 from sat.plugins import plugin_xep_0045 |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
34 from collections import OrderedDict |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
35 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
36 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
37 class FakeMUCClient(object): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
38 def __init__(self, plugin_parent): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
39 self.plugin_parent = plugin_parent |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
40 self.host = plugin_parent.host |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
41 self.joined_rooms = {} |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
42 |
1412 | 43 def join(self, room_jid, nick, options=None, profile_key=C.PROF_KEY_NONE): |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
44 """ |
1412 | 45 @param room_jid: the room JID |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
46 @param nick: nick to be used in the room |
1412 | 47 @param options: joining options |
48 @param profile_key: the profile key of the user joining the room | |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
49 @return: the deferred joined wokkel.muc.Room instance |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
50 """ |
1412 | 51 profile = self.host.memory.getProfileName(profile_key) |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
52 roster = {} |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
53 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
54 # ask the other profiles to fill our roster |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
55 for i in xrange(0, len(C.PROFILE)): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
56 other_profile = C.PROFILE[i] |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
57 if other_profile == profile: |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
58 continue |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
59 try: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
60 other_room = self.plugin_parent.clients[other_profile].joined_rooms[ |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
61 room_jid |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
62 ] |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
63 roster.setdefault( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
64 other_room.nick, User(other_room.nick, C.PROFILE_DICT[other_profile]) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
65 ) |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
66 for other_nick in other_room.roster: |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
67 roster.setdefault(other_nick, other_room.roster[other_nick]) |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
68 except (AttributeError, KeyError): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
69 pass |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
70 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
71 # rename our nick if it already exists |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
72 while nick in roster.keys(): |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
73 if C.PROFILE_DICT[profile].userhost() == roster[nick].entity.userhost(): |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
74 break # same user with different resource --> same nickname |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
75 nick = nick + "_" |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
76 |
1412 | 77 room = Room(room_jid, nick) |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
78 room.roster = roster |
1412 | 79 self.joined_rooms[room_jid] = room |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
80 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
81 # fill the other rosters with the new entry |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
82 for i in xrange(0, len(C.PROFILE)): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
83 other_profile = C.PROFILE[i] |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
84 if other_profile == profile: |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
85 continue |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
86 try: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
87 other_room = self.plugin_parent.clients[other_profile].joined_rooms[ |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
88 room_jid |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
89 ] |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
90 other_room.roster.setdefault( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
91 room.nick, User(room.nick, C.PROFILE_DICT[profile]) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
92 ) |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
93 except (AttributeError, KeyError): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
94 pass |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
95 |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
96 return defer.succeed(room) |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
97 |
1412 | 98 def leave(self, roomJID, profile_key=C.PROF_KEY_NONE): |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
99 """ |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
100 @param roomJID: the room JID |
1412 | 101 @param profile_key: the profile key of the user joining the room |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
102 @return: a dummy deferred |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
103 """ |
1412 | 104 profile = self.host.memory.getProfileName(profile_key) |
105 room = self.joined_rooms[roomJID] | |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
106 # remove ourself from the other rosters |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
107 for i in xrange(0, len(C.PROFILE)): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
108 other_profile = C.PROFILE[i] |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
109 if other_profile == profile: |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
110 continue |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
111 try: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
112 other_room = self.plugin_parent.clients[other_profile].joined_rooms[ |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
113 roomJID |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
114 ] |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
115 del other_room.roster[room.nick] |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
116 except (AttributeError, KeyError): |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
117 pass |
1412 | 118 del self.joined_rooms[roomJID] |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
119 return defer.Deferred() |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
120 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
121 |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
122 class FakeXEP_0045(plugin_xep_0045.XEP_0045): |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
123 def __init__(self, host): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
124 self.host = host |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
125 self.clients = {} |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
126 for profile in C.PROFILE: |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
127 self.clients[profile] = FakeMUCClient(self) |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
128 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
129 def join(self, room_jid, nick, options={}, profile_key="@DEFAULT@"): |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
130 """ |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
131 @param roomJID: the room JID |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
132 @param nick: nick to be used in the room |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
133 @param options: ignore |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
134 @param profile_key: the profile of the user joining the room |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
135 @return: the deferred joined wokkel.muc.Room instance or None |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
136 """ |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
137 profile = self.host.memory.getProfileName(profile_key) |
1412 | 138 if room_jid in self.clients[profile].joined_rooms: |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
139 return defer.succeed(None) |
1412 | 140 room = self.clients[profile].join(room_jid, nick, profile_key=profile) |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
141 return room |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
142 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
143 def joinRoom(self, muc_index, user_index): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
144 """Called by tests |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
145 @return: the nickname of the user who joined room""" |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
146 muc_jid = C.MUC[muc_index] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
147 nick = C.JID[user_index].user |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
148 profile = C.PROFILE[user_index] |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
149 self.join(muc_jid, nick, profile_key=profile) |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
150 return self.getNick(muc_index, user_index) |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
151 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
152 def leave(self, room_jid, profile_key="@DEFAULT@"): |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
153 """ |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
154 @param roomJID: the room JID |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
155 @param profile_key: the profile of the user leaving the room |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
156 @return: a dummy deferred |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
157 """ |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
158 profile = self.host.memory.getProfileName(profile_key) |
1412 | 159 if room_jid not in self.clients[profile].joined_rooms: |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
160 raise plugin_xep_0045.UnknownRoom("This room has not been joined") |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
161 return self.clients[profile].leave(room_jid, profile) |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
162 |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
163 def leaveRoom(self, muc_index, user_index): |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
164 """Called by tests |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
165 @return: the nickname of the user who left the room""" |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
166 muc_jid = C.MUC[muc_index] |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
167 nick = self.getNick(muc_index, user_index) |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
168 profile = C.PROFILE[user_index] |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
169 self.leave(muc_jid, profile_key=profile) |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
170 return nick |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
171 |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
172 def getRoom(self, muc_index, user_index): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
173 """Called by tests |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
174 @return: a wokkel.muc.Room instance""" |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
175 profile = C.PROFILE[user_index] |
1412 | 176 muc_jid = C.MUC[muc_index] |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
177 try: |
1412 | 178 return self.clients[profile].joined_rooms[muc_jid] |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
179 except (AttributeError, KeyError): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
180 return None |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
181 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
182 def getNick(self, muc_index, user_index): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
183 try: |
1412 | 184 return self.getRoomNick(C.MUC[muc_index], C.PROFILE[user_index]) |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
185 except (KeyError, AttributeError): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
186 return "" |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
187 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
188 def getNickOfUser(self, muc_index, user_index, profile_index, secure=True): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
189 try: |
1412 | 190 room = self.clients[C.PROFILE[profile_index]].joined_rooms[C.MUC[muc_index]] |
191 return self.getRoomNickOfUser(room, C.JID[user_index]) | |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
192 except (KeyError, AttributeError): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
193 return None |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
194 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
195 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
196 class FakeXEP_0249(object): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
197 def __init__(self, host): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
198 self.host = host |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
199 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
200 def invite(self, target, room, options={}, profile_key="@DEFAULT@"): |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
201 """ |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
202 Invite a user to a room. To accept the invitation from a test, |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
203 just call FakeXEP_0045.joinRoom (no need to have a dedicated method). |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
204 @param target: jid of the user to invite |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
205 @param room: jid of the room where the user is invited |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
206 @options: attribute with extra info (reason, password) as in #XEP-0249 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
207 @profile_key: %(doc_profile_key)s |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
208 """ |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
209 pass |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
210 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
211 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
212 class FakeSatPubSubClient(object): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
213 def __init__(self, host, parent_plugin): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
214 self.host = host |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
215 self.parent_plugin = parent_plugin |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
216 self.__items = OrderedDict() |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
217 self.__rsm_responses = {} |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
218 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
219 def createNode(self, service, nodeIdentifier=None, options=None, sender=None): |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
220 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
221 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
222 def deleteNode(self, service, nodeIdentifier, sender=None): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
223 try: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
224 del self.__items[nodeIdentifier] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
225 except KeyError: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
226 pass |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
227 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
228 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
229 def subscribe(self, service, nodeIdentifier, subscriber, options=None, sender=None): |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
230 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
231 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
232 def unsubscribe( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
233 self, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
234 service, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
235 nodeIdentifier, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
236 subscriber, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
237 subscriptionIdentifier=None, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
238 sender=None, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
239 ): |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
240 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
241 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
242 def publish(self, service, nodeIdentifier, items=None, sender=None): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
243 node = self.__items.setdefault(nodeIdentifier, []) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
244 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
245 def replace(item_obj): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
246 index = 0 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
247 for current in node: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
248 if current["id"] == item_obj["id"]: |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
249 node[index] = item_obj |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
250 return True |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
251 index += 1 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
252 return False |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
253 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
254 for item in items: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
255 item_obj = parseXml(item) if isinstance(item, unicode) else item |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
256 if not replace(item_obj): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
257 node.append(item_obj) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
258 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
259 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
260 def items( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
261 self, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
262 service, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
263 nodeIdentifier, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
264 maxItems=None, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
265 itemIdentifiers=None, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
266 subscriptionIdentifier=None, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
267 sender=None, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
268 ext_data=None, |
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:
829
diff
changeset
|
270 try: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
271 items = self.__items[nodeIdentifier] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
272 except KeyError: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
273 items = [] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
274 if ext_data: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
275 assert "id" in ext_data |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
276 if "rsm" in ext_data: |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
277 args = (0, items[0]["id"], items[-1]["id"]) if items else () |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
278 self.__rsm_responses[ext_data["id"]] = RSMResponse(len(items), *args) |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
279 return defer.succeed(items) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
280 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
281 def retractItems(self, service, nodeIdentifier, itemIdentifiers, sender=None): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
282 node = self.__items[nodeIdentifier] |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
283 for item in [item for item in node if item["id"] in itemIdentifiers]: |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
284 node.remove(item) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
285 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
286 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
287 def getRSMResponse(self, id): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
288 if id not in self.__rsm_responses: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
289 return {} |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
290 result = self.__rsm_responses[id].toDict() |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
291 del self.__rsm_responses[id] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
292 return result |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
293 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
294 def subscriptions(self, service, nodeIdentifier, sender=None): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
295 return defer.succeed([]) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
296 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
297 def service_getDiscoItems(self, service, nodeIdentifier, profile_key=C.PROF_KEY_NONE): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
298 items = DiscoItems() |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
299 for item in self.__items.keys(): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
300 items.append(DiscoItem(service, item)) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
301 return defer.succeed(items) |