Make NetconfAccess:getItems consistent with lists

The current implementation of getItems was only returning leafs, which
is inconsistent with SysrepoAccess, which also returns lists.
NetconfAccess now also returns lists.

This is needed to implement key-value completion. Later, I could use
a flag to tell getItems, if it should include lists (and other stuff).

Change-Id: I200f8ccf8ec52df239dc98bea1ced47fa711324a
diff --git a/tests/datastore_access.cpp b/tests/datastore_access.cpp
index d15e2dc..09801b2 100644
--- a/tests/datastore_access.cpp
+++ b/tests/datastore_access.cpp
@@ -225,5 +225,31 @@
         REQUIRE(datastore.getItems("/example-schema:leafEnum") == expected);
     }
 
+    SECTION("getItems on a list")
+    {
+        {
+            REQUIRE_CALL(mock, write("/example-schema:person[name='Jan']", "", ""));
+            REQUIRE_CALL(mock, write("/example-schema:person[name='Jan']/name", "", "Jan"));
+            REQUIRE_CALL(mock, write("/example-schema:person[name='Michal']", "", ""));
+            REQUIRE_CALL(mock, write("/example-schema:person[name='Michal']/name", "", "Michal"));
+            REQUIRE_CALL(mock, write("/example-schema:person[name='Petr']", "", ""));
+            REQUIRE_CALL(mock, write("/example-schema:person[name='Petr']/name", "", "Petr"));
+            datastore.createListInstance("/example-schema:person[name='Jan']");
+            datastore.createListInstance("/example-schema:person[name='Michal']");
+            datastore.createListInstance("/example-schema:person[name='Petr']");
+            datastore.commitChanges();
+        }
+        std::map<std::string, leaf_data_> expected{
+            {"/example-schema:person[name='Jan']", std::string{"(list)"}},
+            {"/example-schema:person[name='Jan']/name", std::string{"Jan"}},
+            {"/example-schema:person[name='Michal']", std::string{"(list)"}},
+            {"/example-schema:person[name='Michal']/name", std::string{"Michal"}},
+            {"/example-schema:person[name='Petr']", std::string{"(list)"}},
+            {"/example-schema:person[name='Petr']/name", std::string{"Petr"}}
+        };
+
+        REQUIRE(datastore.getItems("/example-schema:person") == expected);
+    }
+
     waitForCompletionAndBitMore(seq1);
 }