Integrate DataQuery
Change-Id: I439374afe485baf08a4d5a1a02fd70d908bec9e1
diff --git a/tests/enum_completion.cpp b/tests/enum_completion.cpp
index 29f23a7..c6b31d8 100644
--- a/tests/enum_completion.cpp
+++ b/tests/enum_completion.cpp
@@ -8,6 +8,7 @@
*/
#include "trompeloeil_doctest.h"
+#include "datastoreaccess_mock.hpp"
#include "parser.hpp"
#include "pretty_printers.hpp"
#include "static_schema.hpp"
@@ -22,7 +23,16 @@
schema->addList("/", "mod:list", {"number"});
schema->addLeaf("/mod:list", "mod:number", yang::LeafDataTypes::Int32);
schema->addLeafEnum("/mod:list", "mod:leafInList", {"ano", "anoda", "ne", "katoda"});
- Parser parser(schema);
+ 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.
+ ALLOW_CALL(*mockDatastore, listInstances("/mod:list"))
+ .RETURN(std::vector<ListInstance>{});
+
+ // DataQuery gets the schema from DatastoreAccess once
+ auto expectation = NAMED_REQUIRE_CALL(*mockDatastore, schema())
+ .RETURN(schema);
+ auto dataQuery = std::make_shared<DataQuery>(*mockDatastore);
+ Parser parser(schema, dataQuery);
std::string input;
std::ostringstream errorStream;