From 6a0bf6808eed1be96d9dd1baeabe10a95ab10a78 Mon Sep 17 00:00:00 2001 From: Philipp Hempel Date: Fri, 3 May 2024 12:17:24 +0200 Subject: [PATCH] extended internal apitest for templates: use different text delimiters in datastore templates; see #72324 --- test/template/manifest.json | 13 ++++-- test/template/test3.json | 22 ++++++++++ test/template/test4.json | 22 ++++++++++ test/template/test5.json | 87 +++++++++++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+), 3 deletions(-) create mode 100644 test/template/test3.json create mode 100644 test/template/test4.json create mode 100644 test/template/test5.json diff --git a/test/template/manifest.json b/test/template/manifest.json index b00590b..e54d0e6 100644 --- a/test/template/manifest.json +++ b/test/template/manifest.json @@ -6,9 +6,16 @@ "dir": "../_res", "testmode": false }, + "store": { + "test_int": 123, + "test_text": "lorem ipsum" + }, "name": "template tests", "tests": [ - /* printf "%s" "@test1.json" | marshal */"", - "@test2.json" - ], + /* printf "%s" "@test1.json" | marshal */"" + ,"@test2.json" + ,"@test3.json" + ,"@test4.json" + ,"@test5.json" + ] } \ No newline at end of file diff --git a/test/template/test3.json b/test/template/test3.json new file mode 100644 index 0000000..0371e56 --- /dev/null +++ b/test/template/test3.json @@ -0,0 +1,22 @@ +// template-delims: {{ }} +{ + "name": "delimiter in templates: \"", + "request": { + "server_url": "http://localhost:9999", + "endpoint": "bounce-json", + "method": "POST", + "body": { + "num": "integer from datastore: {{ datastore "test_int" }}", + "text": "string from datastore: {{ datastore "test_text" }}" + } + }, + "response": { + "statuscode": 200, + "body": { + "body": { + "num": "integer from datastore: 123", + "text": "string from datastore: lorem ipsum" + } + } + } +} \ No newline at end of file diff --git a/test/template/test4.json b/test/template/test4.json new file mode 100644 index 0000000..280f10a --- /dev/null +++ b/test/template/test4.json @@ -0,0 +1,22 @@ +// template-delims: {{ }} +{ + "name": "delimiter in templates: `", + "request": { + "server_url": "http://localhost:9999", + "endpoint": "bounce-json", + "method": "POST", + "body": { + "num": "integer from datastore: {{ datastore `test_int` }}", + "text": "string from datastore: {{ datastore `test_text` }}" + } + }, + "response": { + "statuscode": 200, + "body": { + "body": { + "num": "integer from datastore: 123", + "text": "string from datastore: lorem ipsum" + } + } + } +} \ No newline at end of file diff --git a/test/template/test5.json b/test/template/test5.json new file mode 100644 index 0000000..7ce923a --- /dev/null +++ b/test/template/test5.json @@ -0,0 +1,87 @@ +// template-delims: {{ }} +[ + { + "name": "delimiter in templates: \"", + "request": { + "server_url": "http://localhost:9999", + "endpoint": "bounce-json", + "method": "POST", + "body": { + "num": "integer from datastore: {{ datastore "test_int" }}", + "text": "string from datastore: {{ datastore "test_text" }}" + } + }, + "response": { + "statuscode": 200, + "body": { + "body": { + "num": "integer from datastore: 123", + "text": "string from datastore: lorem ipsum" + } + } + } + }, + { + "name": "delimiter in templates: `", + "request": { + "server_url": "http://localhost:9999", + "endpoint": "bounce-json", + "method": "POST", + "body": { + "num": "integer from datastore: {{ datastore `test_int` }}", + "text": "string from datastore: {{ datastore `test_text` }}" + } + }, + "response": { + "statuscode": 200, + "body": { + "body": { + "num": "integer from datastore: 123", + "text": "string from datastore: lorem ipsum" + } + } + } + }, + { + "name": "delimiter in templates: \"", + "request": { + "server_url": "http://localhost:9999", + "endpoint": "bounce-json", + "method": "POST", + "body": { + "num": "integer from datastore: 123", + "text": "string from datastore: lorem ipsum" + } + }, + "response": { + "statuscode": 200, + "body": { + "body": { + "num": "integer from datastore: {{ datastore "test_int" }}", + "text": "string from datastore: {{ datastore "test_text" }}" + } + } + } + }, + { + "name": "delimiter in templates: `", + "request": { + "server_url": "http://localhost:9999", + "endpoint": "bounce-json", + "method": "POST", + "body": { + "num": "integer from datastore: 123", + "text": "string from datastore: lorem ipsum" + } + }, + "response": { + "statuscode": 200, + "body": { + "body": { + "num": "integer from datastore: {{ datastore `test_int` }}", + "text": "string from datastore: {{ datastore `test_text` }}" + } + } + } + } +] \ No newline at end of file