From 802d78359f8015e3487918b42621c1cb8bbd1eea Mon Sep 17 00:00:00 2001 From: Fabrice Reix Date: Fri, 2 Sep 2022 10:50:43 +0200 Subject: [PATCH] Update test integ --- integration/tests_ok/variables.curl | 2 +- integration/tests_ok/variables.html | 15 ++++++++++++--- integration/tests_ok/variables.hurl | 12 +++++++++++- integration/tests_ok/variables.json | 2 +- integration/tests_ok/variables.py | 2 ++ 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/integration/tests_ok/variables.curl b/integration/tests_ok/variables.curl index dc7d5a770..8ec683251 100644 --- a/integration/tests_ok/variables.curl +++ b/integration/tests_ok/variables.curl @@ -1 +1 @@ -curl 'http://localhost:8000/variables' -H 'Name: Jennifer' -H 'Age: 30' -H 'Height: 1.7' -H 'Female: true' -H 'Id: 123' -H 'A_Null: null' -H 'Content-Type: application/json' --data $'{\n "name": "Jennifer",\n "age": 30,\n "height": 1.7,\n "female": true,\n "id": "123",\n "a_null": null\n}' +curl 'http://localhost:8000/variables' -H 'Name: Jennifer' -H 'Age: 30' -H 'Height: 1.7' -H 'Female: true' -H 'Id: 123' -H 'A_Null: null' -H 'Country: Italy' -H 'Content-Type: application/json' --data $'{\n "name": "Jennifer",\n "age": 30,\n "height": 1.7,\n "female": true,\n "id": "123",\n "a_null": null,\n "country": "Italy"\n}' diff --git a/integration/tests_ok/variables.html b/integration/tests_ok/variables.html index 097842874..d4b9ef2a1 100644 --- a/integration/tests_ok/variables.html +++ b/integration/tests_ok/variables.html @@ -1,17 +1,26 @@ -
POST http://localhost:8000/variables
+
# Variables can be set from:
+# - an external properties file
+# - at the command-line with the --variable option
+# - in the Hurl File in the [Options] section
+
+POST http://localhost:8000/variables
 Name: {{name}}
 Age: {{age}}
 Height: {{height}}
 Female: {{female}}
 Id: {{my-id}}
 A_Null: {{a_null}}
+Country: {{country}}
+[Options]
+variable: country=Italy
 {
   "name": "{{name}}",
   "age": {{age}},
   "height": {{height}},
   "female": {{female}},
   "id": "{{my-id}}",
-  "a_null": {{a_null}}
+  "a_null": {{a_null}},
+  "country": "{{country}}"
 }
 
 HTTP/* 200
@@ -22,4 +31,4 @@
 variable "height" == 1.70
 variable "a_null" == null
 variable "my-id" == "123"
-
\ No newline at end of file +variable "country" == "Italy"
\ No newline at end of file diff --git a/integration/tests_ok/variables.hurl b/integration/tests_ok/variables.hurl index 1441e6588..86d32db88 100644 --- a/integration/tests_ok/variables.hurl +++ b/integration/tests_ok/variables.hurl @@ -1,3 +1,8 @@ +# Variables can be set from: +# - an external properties file +# - at the command-line with the --variable option +# - in the Hurl File in the [Options] section + POST http://localhost:8000/variables Name: {{name}} Age: {{age}} @@ -5,13 +10,17 @@ Height: {{height}} Female: {{female}} Id: {{my-id}} A_Null: {{a_null}} +Country: {{country}} +[Options] +variable: country=Italy { "name": "{{name}}", "age": {{age}}, "height": {{height}}, "female": {{female}}, "id": "{{my-id}}", - "a_null": {{a_null}} + "a_null": {{a_null}}, + "country": "{{country}}" } HTTP/* 200 @@ -22,3 +31,4 @@ variable "age" == 30 variable "height" == 1.70 variable "a_null" == null variable "my-id" == "123" +variable "country" == "Italy" \ No newline at end of file diff --git a/integration/tests_ok/variables.json b/integration/tests_ok/variables.json index ab95acac6..5522c3bf3 100644 --- a/integration/tests_ok/variables.json +++ b/integration/tests_ok/variables.json @@ -1 +1 @@ -{"entries":[{"request":{"method":"POST","url":"http://localhost:8000/variables","headers":[{"name":"Name","value":"{{name}}"},{"name":"Age","value":"{{age}}"},{"name":"Height","value":"{{height}}"},{"name":"Female","value":"{{female}}"},{"name":"Id","value":"{{my-id}}"},{"name":"A_Null","value":"{{a_null}}"}],"body":{"type":"json","value":{"name":"{{name}}","age":"{{age}}","height":"{{height}}","female":"{{female}}","id":"{{my-id}}","a_null":"{{a_null}}"}}},"response":{"status":200,"asserts":[{"query":{"type":"variable","name":"name"},"predicate":{"type":"equal","value":"Jennifer"}},{"query":{"type":"variable","name":"female"},"predicate":{"type":"equal","value":true}},{"query":{"type":"variable","name":"age"},"predicate":{"type":"equal","value":30}},{"query":{"type":"variable","name":"height"},"predicate":{"type":"equal","value":1.70}},{"query":{"type":"variable","name":"a_null"},"predicate":{"type":"equal","value":null}},{"query":{"type":"variable","name":"my-id"},"predicate":{"type":"equal","value":"123"}}]}}]} \ No newline at end of file +{"entries":[{"request":{"method":"POST","url":"http://localhost:8000/variables","headers":[{"name":"Name","value":"{{name}}"},{"name":"Age","value":"{{age}}"},{"name":"Height","value":"{{height}}"},{"name":"Female","value":"{{female}}"},{"name":"Id","value":"{{my-id}}"},{"name":"A_Null","value":"{{a_null}}"},{"name":"Country","value":"{{country}}"}],"body":{"type":"json","value":{"name":"{{name}}","age":"{{age}}","height":"{{height}}","female":"{{female}}","id":"{{my-id}}","a_null":"{{a_null}}","country":"{{country}}"}}},"response":{"status":200,"asserts":[{"query":{"type":"variable","name":"name"},"predicate":{"type":"equal","value":"Jennifer"}},{"query":{"type":"variable","name":"female"},"predicate":{"type":"equal","value":true}},{"query":{"type":"variable","name":"age"},"predicate":{"type":"equal","value":30}},{"query":{"type":"variable","name":"height"},"predicate":{"type":"equal","value":1.70}},{"query":{"type":"variable","name":"a_null"},"predicate":{"type":"equal","value":null}},{"query":{"type":"variable","name":"my-id"},"predicate":{"type":"equal","value":"123"}},{"query":{"type":"variable","name":"country"},"predicate":{"type":"equal","value":"Italy"}}]}}]} \ No newline at end of file diff --git a/integration/tests_ok/variables.py b/integration/tests_ok/variables.py index 3f80e0647..78b554a01 100644 --- a/integration/tests_ok/variables.py +++ b/integration/tests_ok/variables.py @@ -12,6 +12,7 @@ def variables(): assert request.headers["Id"] == "123" assert request.headers["Height"] == "1.7" assert request.headers["A_null"] == "null" + assert request.headers["Country"] == "Italy" s = request.data.decode("utf-8") data = json.loads(s) @@ -21,4 +22,5 @@ def variables(): assert data["id"] == "123" assert data["height"] == 1.7 assert data["a_null"] is None + assert data["country"] == "Italy" return ""