Restrict 'cd' to the 'prepare' context
The change follows up the previous fix, which blocked 'cd' command in 'prepare' context entirely.
Bug: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/223
Fixes: 218ee7bcbef1c066a2be56f087ab8c824b529188
Change-Id: Iea0902e7981bcf3f9d41425e58cdd64ef6ea0be0
diff --git a/tests/interpreter.cpp b/tests/interpreter.cpp
index 0c03d89..087a9b7 100644
--- a/tests/interpreter.cpp
+++ b/tests/interpreter.cpp
@@ -456,6 +456,9 @@
{
REQUIRE_THROWS(boost::apply_visitor(Interpreter(parser, proxyDatastore), command_{cd_{{}, dataPath_{Scope::Absolute, {dataNode_{module_{{"example"}}, container_{"somewhereElse"}}}}}}));
REQUIRE_THROWS(boost::apply_visitor(Interpreter(parser, proxyDatastore), command_{cd_{{}, dataPath_{Scope::Relative, {dataNode_{nodeup_{}}}}}}));
+
+ // Test that the parser allows to change the current node within the rpc context
+ REQUIRE_NOTHROW(boost::apply_visitor(Interpreter(parser, proxyDatastore), command_{cd_{{}, dataPath_{Scope::Relative, {dataNode_{container_{"payload"}}}}}}));
boost::apply_visitor(Interpreter(parser, proxyDatastore), command_{cancel_{}});
}