hurl/integration/tests_ok/variables.py
jcamiel 28b5a49c1d
Update variables.hurl integration test.
We can define multiple variables in [Options] section. Contrary to other options, variables defined on this request are still available to following entries.
2023-01-03 17:43:13 +01:00

39 lines
1.0 KiB
Python

from flask import request
from app import app
import json
@app.route("/variables", methods=["POST"])
def variables():
assert request.headers["Content-Type"] == "application/json"
assert request.headers["Name"] == "Jennifer"
assert request.headers["Age"] == "30"
assert request.headers["Female"] == "true"
assert request.headers["Id"] == "123"
assert request.headers["Height"] == "1.7"
assert request.headers["A_null"] == "null"
assert request.headers["Country"] == "Italy"
assert request.headers["Planet"] == "The Earth"
s = request.data.decode("utf-8")
data = json.loads(s)
assert data["name"] == "Jennifer"
assert data["age"] == 30
assert data["female"] == True
assert data["id"] == "123"
assert data["height"] == 1.7
assert data["a_null"] is None
assert data["country"] == "Italy"
assert data["planet"] == "The Earth"
return ""
@app.route("/variable/country")
def country():
return "Italy"
@app.route("/variable/planet")
def planet():
return "The Earth"