fix: Inconsistency in get_subscriptions_for_jid

master
PapaTutuWawa 1 year ago
parent 34d001b5bc
commit 498b399813

@ -14,7 +14,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
# TODO: Replace most of these with a query API
import os
import json
@ -67,9 +66,9 @@ class SubscriptionManager:
every subscription a jid has in the context of @module.
"""
if not module in self._subscriptions:
return []
return {}
if not jid in self._subscriptions[module]:
return []
return {}
return self._subscriptions[module][jid]

@ -39,8 +39,8 @@ def get_sum():
def test_get_subscriptions_for_jid():
sum = get_sum()
assert sum.get_subscriptions_for_jid('prod', 'a@localhost') == []
assert sum.get_subscriptions_for_jid('test', 'z@localhost') == []
assert sum.get_subscriptions_for_jid('prod', 'a@localhost') == {}
assert sum.get_subscriptions_for_jid('test', 'z@localhost') == {}
subs = sum.get_subscriptions_for_jid('test', 'a@localhost')
assert len(subs.keys()) == 2

Loading…
Cancel
Save