Fix leafDataFromValue

Leafrefs were not working correctly, when pointing to a data node not in
the tree. Because of this I had to rework the thing a little bit (I
basically copied the algorithm from cla-sysrepo, where I had the same
issue). I also changed the name. And also added test, both versions of
leafref included.

Funnily enough, it seems that I was already fixing this before, but for
some reason the bug appeared again while using netconf-cli, oh well, now
the tests should cover that hopefully.

Change-Id: I8a102c54bf58a4221610c8a83d26979fb7b4461d
diff --git a/src/yang_access.cpp b/src/yang_access.cpp
index 8171c89..a460150 100644
--- a/src/yang_access.cpp
+++ b/src/yang_access.cpp
@@ -284,8 +284,8 @@
             if (child->schema()->nodetype() == LYS_LEAF) {
                 libyang::Schema_Node_Leaf leafSchema(child->schema());
                 if (leafSchema.is_key()) {
-                    libyang::Data_Node_Leaf_List leafData(child);
-                    instance.insert({leafSchema.name(), leafValueFromValue(leafData.value(), leafSchema.type()->base())});
+                    auto leafData = std::make_shared<libyang::Data_Node_Leaf_List>(child);
+                    instance.insert({leafSchema.name(), leafValueFromNode(leafData)});
                 }
             }
         }