From: Arran Cudbard-Bell Date: Wed, 10 Sep 2025 18:15:09 +0000 (+0100) Subject: Add additional test for nested JSON encoding X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8aaa7150cdd1f4f1851a6fcbd64c610ccf9c47a9;p=thirdparty%2Ffreeradius-server.git Add additional test for nested JSON encoding --- diff --git a/src/tests/modules/json/nested_encode_children.unlang b/src/tests/modules/json/nested_encode_children.unlang new file mode 100644 index 0000000000..882495637e --- /dev/null +++ b/src/tests/modules/json/nested_encode_children.unlang @@ -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