Include presence containers in NetconfAccess::getItems

This patch also changes how the datastore test works a little bit. Empty
strings are a good indicator of "nothing". In case of presence
containers, an empty string means that it is present, so I make use of
boost::optional to represent "nothing".

Change-Id: I820d517a21f6ee7457f698ea49ae2e6eb5a7d2de
diff --git a/tests/mock/sysrepo_subscription.cpp b/tests/mock/sysrepo_subscription.cpp
index 801ec1c..7cd5cf3 100644
--- a/tests/mock/sysrepo_subscription.cpp
+++ b/tests/mock/sysrepo_subscription.cpp
@@ -28,9 +28,11 @@
             return SR_ERR_OK;
 
         while (auto change = sess->get_change_next(it)) {
-            m_recorder->write(change->new_val()->xpath(),
-                              change->old_val() ? change->old_val()->val_to_string() : "",
-                              change->new_val()->val_to_string());
+            auto xpath = (change->new_val() ? change->new_val() : change->old_val())->xpath();
+
+            auto oldValue = change->old_val() ? std::optional{change->old_val()->val_to_string()} : std::nullopt;
+            auto newValue = change->new_val() ? std::optional{change->new_val()->val_to_string()} : std::nullopt;
+            m_recorder->write(xpath, oldValue, newValue);
         }
 
         return SR_ERR_OK;
diff --git a/tests/mock/sysrepo_subscription.hpp b/tests/mock/sysrepo_subscription.hpp
index 36681a6..dce6506 100644
--- a/tests/mock/sysrepo_subscription.hpp
+++ b/tests/mock/sysrepo_subscription.hpp
@@ -8,6 +8,7 @@
 
 #pragma once
 
+#include <optional>
 #include <memory>
 
 namespace sysrepo {
@@ -21,7 +22,7 @@
 class Recorder {
 public:
     virtual ~Recorder();
-    virtual void write(const std::string& xpath, const std::string& oldValue, const std::string& newValue) = 0;
+    virtual void write(const std::string& xpath, const std::optional<std::string>& oldValue, const std::optional<std::string>& newValue) = 0;
 };
 
 class SysrepoSubscription {