]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add additional test for nested JSON encoding
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 10 Sep 2025 18:15:09 +0000 (19:15 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 10 Sep 2025 18:15:37 +0000 (19:15 +0100)
src/tests/modules/json/nested_encode_children.unlang [new file with mode: 0644]

diff --git a/src/tests/modules/json/nested_encode_children.unlang b/src/tests/modules/json/nested_encode_children.unlang
new file mode 100644 (file)
index 0000000..8824956
--- /dev/null
@@ -0,0 +1,19 @@
+request := {
+       Event-Timestamp = "2025-09-10T17:58:46Z"
+       Called-Station-Id = "00:11:22:33:44:55"
+       Service-Type = ::Framed-User
+       Acct-Authentic = ::RADIUS
+       Vendor-Specific = {
+               Calix = {
+                       Applied-Role = "my-test-profile"
+                       Walled-Garden-URL = "https://example.org"
+               }
+       }
+}
+
+# Check we get good output for "children of"
+if (!(%json_object_simple.encode('request.[*]') == "{\"Event-Timestamp\":\"2025-09-10T17:58:46Z\",\"Called-Station-Id\":\"00:11:22:33:44:55\",\"Service-Type\":\"Framed-User\",\"Acct-Authentic\":\"RADIUS\",\"Vendor-Specific\":{\"Calix\":{\"Applied-Role\":\"my-test-profile\",\"Walled-Garden-URL\":\"https:\\/\\/example.org\"}}}")) {
+       test_fail
+}
+
+test_pass