fix: Inconsistency in get_subscriptions_for_jid

This commit is contained in:
PapaTutuWawa 2021-06-15 20:34:49 +02:00
parent 34d001b5bc
commit 498b399813
2 changed files with 4 additions and 5 deletions

View File

@ -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]

View File

@ -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