diff options
author | Kim Alvefur <zash@zash.se> | 2018-12-29 21:47:51 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-12-29 21:47:51 +0100 |
commit | 9061782b9a97df2ef95437d632335ae67eb7ffb6 (patch) | |
tree | a5c384ecfd17b457aed5a6abb5289375eeed8b9b /spec/util_pubsub_spec.lua | |
parent | 09cee9f95866a2f928ee77f49bcdf08cc9e5f9e8 (diff) | |
download | prosody-9061782b9a97df2ef95437d632335ae67eb7ffb6.tar.gz prosody-9061782b9a97df2ef95437d632335ae67eb7ffb6.zip |
util.pubsub: Restore subscription index from stored data (fixes #1281)
Diffstat (limited to 'spec/util_pubsub_spec.lua')
-rw-r--r-- | spec/util_pubsub_spec.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/util_pubsub_spec.lua b/spec/util_pubsub_spec.lua index c44832f7..6386100b 100644 --- a/spec/util_pubsub_spec.lua +++ b/spec/util_pubsub_spec.lua @@ -375,4 +375,34 @@ describe("util.pubsub", function () end); end); end); + + describe("restoring data from nodestore", function () + local nodestore = { + data = { + test = { + name = "test"; + config = {}; + affiliations = {}; + subscribers = { + ["someone"] = true; + }; + } + } + }; + function nodestore:users() + return pairs(self.data) + end + function nodestore:get(key) + return self.data[key]; + end + local service = pubsub.new({ + nodestore = nodestore; + }); + it("subscriptions", function () + local ok, ret = service:get_subscriptions(nil, true, nil) + assert.is_true(ok); + assert.same({ { node = "test", jid = "someone", subscription = true, } }, ret); + end); + end); + end); |