From 367615d9047616c699726c63b5e763f2b61221f8 Mon Sep 17 00:00:00 2001 From: Lucas Hinderberger Date: Tue, 4 Jun 2024 15:42:47 +0200 Subject: [PATCH] Test case for file/file_render to marshal pipelines --- test/filemarshal/dummy.txt | 1 + test/filemarshal/dummy_template.json | 3 +++ test/filemarshal/manifest.json | 11 +++++++++++ test/filemarshal/requests.json | 29 ++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 test/filemarshal/dummy.txt create mode 100644 test/filemarshal/dummy_template.json create mode 100644 test/filemarshal/manifest.json create mode 100644 test/filemarshal/requests.json diff --git a/test/filemarshal/dummy.txt b/test/filemarshal/dummy.txt new file mode 100644 index 0000000..3ee0ed4 --- /dev/null +++ b/test/filemarshal/dummy.txt @@ -0,0 +1 @@ +{"foo": "{\n \"dummy\": \"data\"\n}\n"} diff --git a/test/filemarshal/dummy_template.json b/test/filemarshal/dummy_template.json new file mode 100644 index 0000000..88b578d --- /dev/null +++ b/test/filemarshal/dummy_template.json @@ -0,0 +1,3 @@ +{ + "dummy": {{ printf `"data"` }} +} diff --git a/test/filemarshal/manifest.json b/test/filemarshal/manifest.json new file mode 100644 index 0000000..4e1d34f --- /dev/null +++ b/test/filemarshal/manifest.json @@ -0,0 +1,11 @@ +{ + "http_server": { + "addr": ":9999", + "dir": "./", + "testmode": false + }, + "name": "ensure a file_render to JSON marshal pipe works as expected", + "tests": [ + "@requests.json" + ] +} diff --git a/test/filemarshal/requests.json b/test/filemarshal/requests.json new file mode 100644 index 0000000..7a66e49 --- /dev/null +++ b/test/filemarshal/requests.json @@ -0,0 +1,29 @@ +[ + { + "name": "file_render to marshal pipeline should pass", + "request": { + "server_url": "http://localhost:9999", + "endpoint": "dummy.txt", + "method": "GET" + }, + "response": { + "body": { + "foo": {{ file_render "dummy_template.json" | marshal }} + } + } + }, + { + "name": "file to marshal pipeline should fail", + "request": { + "server_url": "http://localhost:9999", + "endpoint": "dummy.txt", + "method": "GET" + }, + "response": { + "body": { + "foo": {{ file "dummy_template.json" | marshal }} + } + }, + "reverse_test_result": true + } +]