Changeset

11276:7b2ee8995af9

storage tests: Add test for querying a set of IDs
author Kim Alvefur <zash@zash.se>
date Tue, 12 Jan 2021 18:03:40 +0100
parents 11275:b8fada57faf0
children 11277:1256f32f21b6
files spec/core_storagemanager_spec.lua
diffstat 1 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/spec/core_storagemanager_spec.lua	Tue Jan 12 17:00:27 2021 +0100
+++ b/spec/core_storagemanager_spec.lua	Tue Jan 12 18:03:40 2021 +0100
@@ -382,6 +382,30 @@
 						assert.equal(2, count);
 					end);
 
+					it("by multiple ids", function ()
+						assert.truthy(archive.caps and archive.caps.ids, "Multilpe ID query")
+						local data, err = archive:find("user", {
+								["ids"] = {
+									test_data[2][1];
+									test_data[4][1];
+								};
+							});
+						assert.truthy(data, err);
+						local count = 0;
+						for id, item in data do
+							count = count + 1;
+							assert.truthy(id);
+							assert.equal(test_data[count==1 and 2 or 4][1], id);
+							assert(st.is_stanza(item));
+							assert.equal("test", item.name);
+							assert.equal("urn:example:foo", item.attr.xmlns);
+							assert.equal(2, #item.tags);
+						end
+						assert.equal(2, count);
+
+					end);
+
+
 				end);
 
 				it("can selectively delete items", function ()