Disable readonly data paths in set

The first solution to this was to just filter operational nodes directly
inside NodeParser. That however can't work, because we might want to
parse operational data paths (for `get` and also `ls`). That means I
have to define, what gets filtered out, outside of NodeParser. The first
thing that came to mind is using a template argument, however, that
can't be used with lambdas (at least not easily). Instead I just use the
constructor and std::function.

Change-Id: Ic9e503ff721970066ef53d7b5626ff153ad44e18
diff --git a/tests/path_completion.cpp b/tests/path_completion.cpp
index bfc83d2..71fc917 100644
--- a/tests/path_completion.cpp
+++ b/tests/path_completion.cpp
@@ -37,6 +37,7 @@
     schema->addLeaf("/example:twoKeyList", "example:name", yang::String{});
     schema->addLeaf("/example:twoKeyList", "example:number", yang::Int32{});
     schema->addLeaf("/", "example:leafInt", yang::Int32{});
+    schema->addLeaf("/", "example:readonly", yang::Int32{}, yang::AccessType::ReadOnly);
     auto mockDatastore = std::make_shared<MockDatastoreAccess>();
 
     // The parser will use DataQuery for key value completion, but I'm not testing that here, so I don't return anything.
@@ -66,14 +67,14 @@
         SECTION("ls ")
         {
             input = "ls ";
-            expectedCompletions = {"example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list", "example:ovoce", "example:ovocezelenina", "example:twoKeyList", "second:amelie/"};
+            expectedCompletions = {"example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list", "example:ovoce", "example:readonly ", "example:ovocezelenina", "example:twoKeyList", "second:amelie/"};
             expectedContextLength = 0;
         }
 
         SECTION("ls e")
         {
             input = "ls e";
-            expectedCompletions = {"example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list", "example:ovoce", "example:ovocezelenina", "example:twoKeyList"};
+            expectedCompletions = {"example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list", "example:ovoce", "example:readonly ", "example:ovocezelenina", "example:twoKeyList"};
             expectedContextLength = 1;
         }
 
@@ -101,14 +102,14 @@
         SECTION("ls /")
         {
             input = "ls /";
-            expectedCompletions = {"example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list", "example:ovoce", "example:ovocezelenina", "example:twoKeyList", "second:amelie/"};
+            expectedCompletions = {"example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list", "example:ovoce", "example:readonly ", "example:ovocezelenina", "example:twoKeyList", "second:amelie/"};
             expectedContextLength = 0;
         }
 
         SECTION("ls /e")
         {
             input = "ls /e";
-            expectedCompletions = {"example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list", "example:ovoce", "example:ovocezelenina", "example:twoKeyList"};
+            expectedCompletions = {"example:ano/", "example:anoda/", "example:bota/", "example:leafInt ", "example:list", "example:ovoce", "example:readonly ", "example:ovocezelenina", "example:twoKeyList"};
             expectedContextLength = 1;
         }
 
@@ -312,6 +313,12 @@
         }
     }
 
+    SECTION("no readonly data leafs in set")
+    {
+        input = "set example:read";
+        expectedContextLength = 12;
+    }
+
     SECTION("clear completions when no longer inputting path")
     {
         input = "set example:leafInt ";