hurl/integration/tests_ok/assert_json.py

60 lines
1.0 KiB
Python
Raw Normal View History

from app import app
2020-08-27 10:07:46 +03:00
from flask import Response
2020-08-27 10:07:46 +03:00
@app.route("/assert-json")
def assert_json():
return Response(
"""{
"count": 5,
2020-08-27 10:07:46 +03:00
"success": false,
"errors": [{"id":"error1"},{"id":"error2"}],
"warnings": [],
"duration": 1.5,
"tags": ["test"],
"nullable": null
}""",
mimetype="application/json",
)
2020-08-27 10:07:46 +03:00
@app.route("/assert-json/index")
def assert_json_index():
return "1"
@app.route("/assert-json/list")
def assert_json_list():
return Response(
"""[
{ "id": 1, "name": "Bob"},
{ "id": 2, "name": "Bill"}
]""",
mimetype="application/json",
)
@app.route("/assert-json/filter")
def assert_json_filter():
return Response(
"""{
"fruit": [
{
"name": "apple",
"price": {
"US": 100,
"UN": 110
}
},
{
"name": "grape",
"price": {
"US": 200,
"UN": 150
}
}
]
}""",
mimetype="application/json",
)