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/leaf_editing.cpp b/tests/leaf_editing.cpp
index d955ab0..6da7868 100644
--- a/tests/leaf_editing.cpp
+++ b/tests/leaf_editing.cpp
@@ -73,6 +73,7 @@
         yang::TypeInfo{yang::Empty{}},
     }});
     schema->addLeaf("/", "mod:dummy", yang::Empty{});
+    schema->addLeaf("/", "mod:readonly", yang::Int32{}, yang::AccessType::ReadOnly);
 
     Parser parser(schema);
     std::string input;
@@ -606,6 +607,11 @@
             input = "set ";
         }
 
+        SECTION("setting readonly data")
+        {
+            input = "set mod:readonly 123";
+        }
+
         REQUIRE_THROWS_AS(parser.parseCommand(input, errorStream), InvalidCommandException);
         REQUIRE(errorStream.str().find(expectedError) != std::string::npos);
     }