Mercurial > libervia-backend
annotate src/test/helpers_plugins.py @ 1269:91e5becc6623
test: add tests for plugin_misc_groupblog
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 15 Dec 2014 14:05:28 +0100 |
parents | 187d2443c82d |
children | 037ec0795a85 |
rev | line source |
---|---|
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1 #!/usr/bin/python |
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 |
811 | 5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jérôme Poisson (goffi@goffi.org) |
6 # Copyright (C) 2013, 2014 Adrien Cossa (souliane@mailoo.org) | |
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.rsm import RSMResponse |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
27 from wokkel.generic import parseXml |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
28 from wokkel.disco import DiscoItem, DiscoItems |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
29 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
30 from constants import Const as C |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
31 from sat.plugins import plugin_xep_0045 |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
32 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
|
33 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
34 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
35 class FakeMUCClient(object): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
36 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
|
37 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
|
38 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
|
39 self.joined_rooms = {} |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
40 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
41 def join(self, roomJID, nick, profile): |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
42 """ |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
43 @param roomJID: the room JID |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
44 @param nick: nick to be used in the room |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
45 @param profile: the profile of the user joining the room |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
46 @return: the deferred joined wokkel.muc.Room instance |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
47 """ |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
48 roster = {} |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
49 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
50 # 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
|
51 for i in xrange(0, len(C.PROFILE)): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
52 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
|
53 if other_profile == profile: |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
54 continue |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
55 try: |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
56 other_room = self.plugin_parent.clients[other_profile].joined_rooms[roomJID.userhost()] |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
57 roster.setdefault(other_room.nick, User(other_room.nick, C.PROFILE_DICT[other_profile])) |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
58 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
|
59 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
|
60 except (AttributeError, KeyError): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
61 pass |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
62 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
63 # 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
|
64 while nick in roster.keys(): |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
65 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
|
66 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
|
67 nick = nick + "_" |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
68 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
69 room = Room(roomJID, nick) |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
70 room.roster = roster |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
71 self.joined_rooms[roomJID.userhost()] = room |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
72 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
73 # 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
|
74 for i in xrange(0, len(C.PROFILE)): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
75 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
|
76 if other_profile == profile: |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
77 continue |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
78 try: |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
79 other_room = self.plugin_parent.clients[other_profile].joined_rooms[roomJID.userhost()] |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
80 other_room.roster.setdefault(room.nick, User(room.nick, C.PROFILE_DICT[profile])) |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
81 except (AttributeError, KeyError): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
82 pass |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
83 |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
84 return defer.succeed(room) |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
85 |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
86 def leave(self, roomJID, profile): |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
87 """ |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
88 @param roomJID: the room JID |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
89 @param profile: the profile of the user joining the room |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
90 @return: a dummy deferred |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
91 """ |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
92 room = self.joined_rooms[roomJID.userhost()] |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
93 # remove ourself from the other rosters |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
94 for i in xrange(0, len(C.PROFILE)): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
95 other_profile = C.PROFILE[i] |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
96 if other_profile == profile: |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
97 continue |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
98 try: |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
99 other_room = self.plugin_parent.clients[other_profile].joined_rooms[roomJID.userhost()] |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
100 del other_room.roster[room.nick] |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
101 except (AttributeError, KeyError): |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
102 pass |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
103 del self.joined_rooms[roomJID.userhost()] |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
104 return defer.Deferred() |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
105 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
106 |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
107 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
|
108 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
109 def __init__(self, host): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
110 self.host = host |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
111 self.clients = {} |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
112 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
|
113 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
|
114 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
115 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
|
116 """ |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
117 @param roomJID: the room JID |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
118 @param nick: nick to be used in the room |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
119 @param options: ignore |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
120 @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
|
121 @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
|
122 """ |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
123 profile = self.host.memory.getProfileName(profile_key) |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
124 room_jid_s = room_jid.userhost() |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
125 if room_jid_s in self.clients[profile].joined_rooms: |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
126 return defer.succeed(None) |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
127 room = self.clients[profile].join(room_jid, nick, profile) |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
128 return room |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
129 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
130 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
|
131 """Called by tests |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
132 @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
|
133 muc_jid = C.MUC[muc_index] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
134 nick = C.JID[user_index].user |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
135 profile = C.PROFILE[user_index] |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
136 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
|
137 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
|
138 |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
139 def leave(self, room_jid, profile_key='@DEFAULT@'): |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
140 """ |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
141 @param roomJID: the room JID |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
142 @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
|
143 @return: a dummy deferred |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
144 """ |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
145 profile = self.host.memory.getProfileName(profile_key) |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
146 room_jid_s = room_jid.userhost() |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
147 if room_jid_s not in self.clients[profile].joined_rooms: |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
148 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
|
149 return self.clients[profile].leave(room_jid, profile) |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
150 |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
151 def leaveRoom(self, muc_index, user_index): |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
152 """Called by tests |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
153 @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
|
154 muc_jid = C.MUC[muc_index] |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
155 nick = self.getNick(muc_index, user_index) |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
156 profile = C.PROFILE[user_index] |
829
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
157 self.leave(muc_jid, profile_key=profile) |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
158 return nick |
187d2443c82d
test: improvements for the helpers classes:
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
159 |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
160 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
|
161 """Called by tests |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
162 @return: a wokkel.muc.Room instance""" |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
163 profile = C.PROFILE[user_index] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
164 muc_s = C.MUC_STR[muc_index] |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
165 try: |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
166 return self.clients[profile].joined_rooms[muc_s] |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
167 except (AttributeError, KeyError): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
168 return None |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
169 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
170 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
|
171 try: |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
172 return self.getRoomNick(C.MUC_STR[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
|
173 except (KeyError, AttributeError): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
174 return '' |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
175 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
176 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
|
177 try: |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
178 room = self.clients[C.PROFILE[profile_index]].joined_rooms[C.MUC_STR[muc_index]] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
179 return self.getRoomNickOfUser(room, C.JID_STR[user_index]) |
794
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
180 except (KeyError, AttributeError): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
181 return None |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
182 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
183 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
184 class FakeXEP_0249(object): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
185 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
186 def __init__(self, host): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
187 self.host = host |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
188 |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
189 def invite(self, target, room, options={}, profile_key='@DEFAULT@'): |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
190 """ |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
191 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
|
192 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
|
193 @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
|
194 @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
|
195 @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
|
196 @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
|
197 """ |
52c4b755aba6
test: make FakeClient profile dependent and add some tools to test MUC
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
198 pass |
1269
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
199 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
200 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
201 class FakeSatPubSubClient(object): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
202 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
203 def __init__(self, host, parent_plugin): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
204 self.host = host |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
205 self.parent_plugin = parent_plugin |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
206 self.__items = OrderedDict() |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
207 self.__rsm_responses = {} |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
208 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
209 def createNode(self, service, nodeIdentifier=None, options=None, |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
210 sender=None): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
211 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
212 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
213 def deleteNode(self, service, nodeIdentifier, sender=None): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
214 try: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
215 del self.__items[nodeIdentifier] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
216 except KeyError: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
217 pass |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
218 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
219 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
220 def subscribe(self, service, nodeIdentifier, subscriber, |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
221 options=None, sender=None): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
222 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
223 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
224 def unsubscribe(self, service, nodeIdentifier, subscriber, |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
225 subscriptionIdentifier=None, sender=None): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
226 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
227 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
228 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
|
229 node = self.__items.setdefault(nodeIdentifier, []) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
230 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
231 def replace(item_obj): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
232 index = 0 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
233 for current in node: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
234 if current['id'] == item_obj['id']: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
235 node[index] = item_obj |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
236 return True |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
237 index += 1 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
238 return False |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
239 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
240 for item in items: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
241 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
|
242 if not replace(item_obj): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
243 node.append(item_obj) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
244 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
245 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
246 def items(self, service, nodeIdentifier, maxItems=None, itemIdentifiers=None, |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
247 subscriptionIdentifier=None, sender=None, ext_data=None): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
248 try: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
249 items = self.__items[nodeIdentifier] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
250 except KeyError: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
251 items = [] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
252 if ext_data: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
253 assert('id' in ext_data) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
254 if 'rsm' in ext_data: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
255 args = (0, items[0]['id'], items[-1]['id']) if items else () |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
256 self.__rsm_responses[ext_data['id']] = RSMResponse(len(items), *args) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
257 return defer.succeed(items) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
258 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
259 def retractItems(self, service, nodeIdentifier, itemIdentifiers, sender=None): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
260 node = self.__items[nodeIdentifier] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
261 for item in [item for item in node if item['id'] in itemIdentifiers]: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
262 node.remove(item) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
263 return defer.succeed(None) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
264 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
265 def getRSMResponse(self, id): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
266 if id not in self.__rsm_responses: |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
267 return {} |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
268 result = self.__rsm_responses[id].toDict() |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
269 del self.__rsm_responses[id] |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
270 return result |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
271 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
272 def subscriptions(self, service, nodeIdentifier, sender=None): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
273 return defer.succeed([]) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
274 |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
275 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
|
276 items = DiscoItems() |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
277 for item in self.__items.keys(): |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
278 items.append(DiscoItem(service, item)) |
91e5becc6623
test: add tests for plugin_misc_groupblog
souliane <souliane@mailoo.org>
parents:
829
diff
changeset
|
279 return defer.succeed(items) |