Add non-renderable variables

This commit is contained in:
Fabrice Reix 2023-12-05 08:58:40 +01:00
parent 25fff31be1
commit 947603af12
No known key found for this signature in database
GPG Key ID: BF5213154B2E7155
5 changed files with 36 additions and 11 deletions

View File

@ -1,7 +1,21 @@
error: Unrenderable variable
--> tests_failed/template_variable_not_renderable.hurl:10:11
--> tests_failed/template_variable_not_renderable.hurl:12:9
|
10 | param1: {{list}}
12 | list: {{list}}
| ^^^^ variable <list> with value [1,2,3] can not be rendered
|
error: Unrenderable variable
--> tests_failed/template_variable_not_renderable.hurl:17:11
|
17 | object: {{object}}
| ^^^^^^ variable <object> with value Object() can not be rendered
|
error: Unrenderable variable
--> tests_failed/template_variable_not_renderable.hurl:22:12
|
22 | nodeset: {{nodeset}}
| ^^^^^^^ variable <nodeset> with value Nodeset1 can not be rendered
|

View File

@ -1,12 +1,23 @@
# Only variables with scalar value (string, integer, ...) can be rendered in template
GET http://localhost:8000/get-list
GET http://localhost:8000/get-variables-not-renderable
HTTP 200
[Captures]
list: jsonpath "$.values"
list: jsonpath "$.list"
object: jsonpath "$.object"
nodeset: jsonpath "$.nodeset" xpath "/"
GET http://localhost:8000/undefined
[QueryStringParams]
param1: {{list}}
list: {{list}}
HTTP 200
GET http://localhost:8000/undefined
[QueryStringParams]
object: {{object}}
HTTP 200
GET http://localhost:8000/undefined
[QueryStringParams]
nodeset: {{nodeset}}
HTTP 200

View File

@ -1,3 +1,3 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
hurl tests_failed/template_variable_not_renderable.hurl
hurl tests_failed/template_variable_not_renderable.hurl --continue-on-error

View File

@ -1,6 +1,6 @@
from app import app
@app.route("/get-list")
def get_list():
return '{"values":[1,2,3]}'
@app.route("/get-variables-not-renderable")
def get_variables_not_renderable():
return '{"list":[1,2,3], "object":{"id":1}, "nodeset": "<node></node>"}'

View File

@ -1,3 +1,3 @@
#!/bin/bash
set -Eeuo pipefail
hurl tests_failed/template_variable_not_renderable.hurl
hurl tests_failed/template_variable_not_renderable.hurl --continue-on-error