mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-29 12:13:01 +02:00
105 lines
3.2 KiB
Diff
105 lines
3.2 KiB
Diff
From 9997d61dc43775444e4d78c37054a30b602c2603 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
|
Date: Thu, 13 Mar 2025 18:11:39 +0100
|
|
Subject: [PATCH 32/44] Fix bug in depth= processing
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
Organization: Wires
|
|
|
|
...which got fixed upstream in sysrepo.
|
|
|
|
Change-Id: Ida37c48058488be32230165b8b4f45c6bd5a4d3a
|
|
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/dependencies/+/8429
|
|
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
|
---
|
|
CMakeLists.txt | 1 +
|
|
tests/restconf-reading.cpp | 45 ++++++++++++++++++++++++++++++++++++++
|
|
2 files changed, 46 insertions(+)
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index ca41ef3..272caad 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -74,6 +74,7 @@ find_package(PkgConfig)
|
|
pkg_check_modules(nghttp2 REQUIRED IMPORTED_TARGET libnghttp2_asio>=0.0.90 libnghttp2) # To compile under boost 1.87 you have to patch nghttp2-asio using https://github.com/nghttp2/nghttp2-asio/issues/23
|
|
find_package(Boost 1.66 REQUIRED CONFIG COMPONENTS system thread)
|
|
|
|
+pkg_check_modules(SYSREPO REQUIRED sysrepo>=3.6.5 IMPORTED_TARGET)
|
|
pkg_check_modules(SYSREPO-CPP REQUIRED IMPORTED_TARGET sysrepo-cpp>=5)
|
|
pkg_check_modules(LIBYANG-CPP REQUIRED IMPORTED_TARGET libyang-cpp>=3)
|
|
pkg_check_modules(SYSTEMD IMPORTED_TARGET libsystemd)
|
|
diff --git a/tests/restconf-reading.cpp b/tests/restconf-reading.cpp
|
|
index 38f5496..f87c4f5 100644
|
|
--- a/tests/restconf-reading.cpp
|
|
+++ b/tests/restconf-reading.cpp
|
|
@@ -243,6 +243,13 @@ TEST_CASE("reading data")
|
|
)"});
|
|
|
|
REQUIRE(get(RESTCONF_DATA_ROOT "/ietf-system:system/radius?depth=1", {AUTH_DWDM}) == Response{200, jsonHeaders, R"({
|
|
+ "ietf-system:system": {
|
|
+ "radius": {}
|
|
+ }
|
|
+}
|
|
+)"});
|
|
+
|
|
+ REQUIRE(get(RESTCONF_DATA_ROOT "/ietf-system:system/radius?depth=2", {AUTH_DWDM}) == Response{200, jsonHeaders, R"({
|
|
"ietf-system:system": {
|
|
"radius": {
|
|
"server": [
|
|
@@ -1026,6 +1033,25 @@ TEST_CASE("reading data")
|
|
}
|
|
)"});
|
|
REQUIRE(get(RESTCONF_DATA_ROOT "/example:tlc/list=blabla?fields=nested/data&depth=1", {}) == Response{200, jsonHeaders, R"({
|
|
+ "example:tlc": {
|
|
+ "list": [
|
|
+ {
|
|
+ "name": "blabla",
|
|
+ "nested": [
|
|
+ {
|
|
+ "first": "1",
|
|
+ "second": 2,
|
|
+ "third": "3",
|
|
+ "data": {}
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+}
|
|
+)"});
|
|
+
|
|
+ REQUIRE(get(RESTCONF_DATA_ROOT "/example:tlc/list=blabla?fields=nested/data&depth=2", {}) == Response{200, jsonHeaders, R"({
|
|
"example:tlc": {
|
|
"list": [
|
|
{
|
|
@@ -1049,6 +1075,25 @@ TEST_CASE("reading data")
|
|
|
|
// whole datastore with fields filtering
|
|
REQUIRE(get(RESTCONF_DATA_ROOT "?fields=example:tlc/list/nested/data&depth=1", {}) == Response{200, jsonHeaders, R"({
|
|
+ "example:tlc": {
|
|
+ "list": [
|
|
+ {
|
|
+ "name": "blabla",
|
|
+ "nested": [
|
|
+ {
|
|
+ "first": "1",
|
|
+ "second": 2,
|
|
+ "third": "3",
|
|
+ "data": {}
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+}
|
|
+)"});
|
|
+
|
|
+ REQUIRE(get(RESTCONF_DATA_ROOT "?fields=example:tlc/list/nested/data&depth=2", {}) == Response{200, jsonHeaders, R"({
|
|
"example:tlc": {
|
|
"list": [
|
|
{
|
|
--
|
|
2.43.0
|
|
|