Software /
code /
prosody
Comparison
spec/util_pubsub_spec.lua @ 9742:18eca6afb367 0.11
util.pubsub: Restore subscription index from stored data (fixes #1281)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 29 Dec 2018 21:47:51 +0100 |
parent | 9516:038446c50630 |
child | 9816:7f84d7f77a00 |
comparison
equal
deleted
inserted
replaced
9729:4f6413ec08a8 | 9742:18eca6afb367 |
---|---|
373 assert.is_true(ok); | 373 assert.is_true(ok); |
374 assert.same({ "one", "three", "two", two = "hello again", three = "hey", one = "bye" }, items); | 374 assert.same({ "one", "three", "two", two = "hello again", three = "hey", one = "bye" }, items); |
375 end); | 375 end); |
376 end); | 376 end); |
377 end); | 377 end); |
378 | |
379 describe("restoring data from nodestore", function () | |
380 local nodestore = { | |
381 data = { | |
382 test = { | |
383 name = "test"; | |
384 config = {}; | |
385 affiliations = {}; | |
386 subscribers = { | |
387 ["someone"] = true; | |
388 }; | |
389 } | |
390 } | |
391 }; | |
392 function nodestore:users() | |
393 return pairs(self.data) | |
394 end | |
395 function nodestore:get(key) | |
396 return self.data[key]; | |
397 end | |
398 local service = pubsub.new({ | |
399 nodestore = nodestore; | |
400 }); | |
401 it("subscriptions", function () | |
402 local ok, ret = service:get_subscriptions(nil, true, nil) | |
403 assert.is_true(ok); | |
404 assert.same({ { node = "test", jid = "someone", subscription = true, } }, ret); | |
405 end); | |
406 end); | |
407 | |
378 end); | 408 end); |