Software /
code /
prosody
Comparison
spec/core_storagemanager_spec.lua @ 10837:f23363380599
mod_storage_internal: Implement key-value API
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 11 May 2020 21:56:19 +0200 |
parent | 10836:93019f3edd68 |
child | 10842:5a6ba2f38e2b |
comparison
equal
deleted
inserted
replaced
10836:93019f3edd68 | 10837:f23363380599 |
---|---|
437 assert(st.is_stanza(item)); | 437 assert(st.is_stanza(item)); |
438 end | 438 end |
439 assert.equal(2, count); | 439 assert.equal(2, count); |
440 assert(archive:delete("user-issue1073")); | 440 assert(archive:delete("user-issue1073")); |
441 end); | 441 end); |
442 | |
443 it("can be treated as a map store", function () | |
444 assert.falsy(archive:get("mapuser", "no-such-id")); | |
445 assert.falsy(archive:set("mapuser", "no-such-id", test_stanza)); | |
446 | |
447 local id = archive:append("mapuser", nil, test_stanza, test_time, "contact@example.com"); | |
448 assert.same(test_stanza, archive:get("mapuser", id)); | |
449 | |
450 local replacement_stanza = st.stanza("test", { xmlns = "urn:example:foo" }) | |
451 :tag("bar"):up() | |
452 :reset(); | |
453 assert(archive:set("mapuser", id, replacement_stanza)); | |
454 assert.same(replacement_stanza, archive:get("mapuser", id)); | |
455 end); | |
456 | |
442 end); | 457 end); |
443 end); | 458 end); |
444 end | 459 end |
445 end); | 460 end); |