Skip to content

Commit

Permalink
extended internal apitest for templates: use different text delimiter…
Browse files Browse the repository at this point in the history
…s in datastore templates; see #72324
  • Loading branch information
Philipp Hempel committed May 3, 2024
1 parent 1599649 commit 6a0bf68
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/template/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 */"<placeholder>",
"@test2.json"
],
/* printf "%s" "@test1.json" | marshal */"<placeholder>"
,"@test2.json"
,"@test3.json"
,"@test4.json"
,"@test5.json"
]
}
22 changes: 22 additions & 0 deletions test/template/test3.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
22 changes: 22 additions & 0 deletions test/template/test4.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
87 changes: 87 additions & 0 deletions test/template/test5.json
Original file line number Diff line number Diff line change
@@ -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` }}"
}
}
}
}
]

0 comments on commit 6a0bf68

Please sign in to comment.