Fix NetconfAccess::deleteListInstance

Yet another problem Data_Node problem - you get the whole tree from
dataNodeFromPath, not the actual node you wanted. It seems I fixed it
previously with a child() call, which is wrong and won't work with a lot
of stuff.

Change-Id: I074f24e628b907edeadbd822803a99be639fb0b1
diff --git a/src/netconf_access.cpp b/src/netconf_access.cpp
index cdd9849..4da25e9 100644
--- a/src/netconf_access.cpp
+++ b/src/netconf_access.cpp
@@ -108,7 +108,8 @@
 void NetconfAccess::deleteListInstance(const std::string& path)
 {
     auto node = m_schema->dataNodeFromPath(path);
-    node->child()->insert_attr(m_schema->getYangModule("ietf-netconf"), "operation", "delete");
+    auto list = *(node->find_path(path.c_str())->data().begin());
+    list->insert_attr(m_schema->getYangModule("ietf-netconf"), "operation", "delete");
     doEditFromDataNode(node);
 }
 
diff --git a/tests/datastore_access.cpp b/tests/datastore_access.cpp
index 4a25803..fe7df81 100644
--- a/tests/datastore_access.cpp
+++ b/tests/datastore_access.cpp
@@ -138,12 +138,20 @@
         datastore.commitChanges();
     }
 
-    SECTION("create a list instance")
+    SECTION("create/delete a list instance")
     {
-        REQUIRE_CALL(mock, write("/example-schema:person[name='Nguyen']", std::nullopt, ""s));
-        REQUIRE_CALL(mock, write("/example-schema:person[name='Nguyen']/name", std::nullopt, "Nguyen"s));
-        datastore.createListInstance("/example-schema:person[name='Nguyen']");
-        datastore.commitChanges();
+        {
+            REQUIRE_CALL(mock, write("/example-schema:person[name='Nguyen']", std::nullopt, ""s));
+            REQUIRE_CALL(mock, write("/example-schema:person[name='Nguyen']/name", std::nullopt, "Nguyen"s));
+            datastore.createListInstance("/example-schema:person[name='Nguyen']");
+            datastore.commitChanges();
+        }
+        {
+            REQUIRE_CALL(mock, write("/example-schema:person[name='Nguyen']", ""s, std::nullopt));
+            REQUIRE_CALL(mock, write("/example-schema:person[name='Nguyen']/name", "Nguyen"s, std::nullopt));
+            datastore.deleteListInstance("/example-schema:person[name='Nguyen']");
+            datastore.commitChanges();
+        }
     }
 
     SECTION("leafref pointing to a key of a list")