Allow listing all module nodes with moduleName:*
Change-Id: I1c9d8ace936641db06f38c292655b3c5c5557385
diff --git a/tests/sysrepo.cpp b/tests/sysrepo.cpp
index 7125a9a..9c04bf9 100644
--- a/tests/sysrepo.cpp
+++ b/tests/sysrepo.cpp
@@ -187,5 +187,31 @@
REQUIRE(datastore.getItems("/example-schema:down") == expected);
}
+ SECTION("getting items from the whole module")
+ {
+ {
+ REQUIRE_CALL(mock, write("/example-schema:up", "", "true"));
+ REQUIRE_CALL(mock, write("/example-schema:down", "", "false"));
+ datastore.setLeaf("/example-schema:up", bool{true});
+ datastore.setLeaf("/example-schema:down", bool{false});
+ datastore.commitChanges();
+ }
+
+ std::map<std::string, leaf_data_> expected{{"/example-schema:down", bool{false}},
+ // Sysrepo always returns containers when getting values, but
+ // libnetconf does not. This is fine by the YANG standard:
+ // https://tools.ietf.org/html/rfc7950#section-7.5.7 Furthermore,
+ // NetconfAccess implementation actually only iterates over leafs,
+ // so even if libnetconf did include containers, they wouldn't get
+ // shown here anyway. With sysrepo2, this won't be necessary,
+ // because it'll use the same data structure as libnetconf, so the
+ // results will be consistent.
+#ifdef sysrepo_BACKEND
+ {"/example-schema:lol", std::string{"(container)"}},
+#endif
+ {"/example-schema:up", bool{true}}};
+ REQUIRE(datastore.getItems("/example-schema:*") == expected);
+ }
+
waitForCompletionAndBitMore(seq1);
}