2022-02-14 11:13:33 +03:00
|
|
|
from app import app
|
2020-08-27 10:07:46 +03:00
|
|
|
from flask import Response
|
|
|
|
|
2022-02-05 08:56:33 +03:00
|
|
|
|
2020-08-27 10:07:46 +03:00
|
|
|
@app.route("/assert-json")
|
|
|
|
def assert_json():
|
2022-02-05 08:56:33 +03:00
|
|
|
return Response(
|
|
|
|
"""{
|
2020-11-29 19:21:02 +03:00
|
|
|
"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
|
2022-02-05 08:56:33 +03:00
|
|
|
}""",
|
|
|
|
mimetype="application/json",
|
|
|
|
)
|
2020-08-27 10:07:46 +03:00
|
|
|
|
|
|
|
|
|
|
|
@app.route("/assert-json/index")
|
|
|
|
def assert_json_index():
|
2020-11-25 18:43:44 +03:00
|
|
|
return "1"
|
|
|
|
|
2022-02-05 08:56:33 +03:00
|
|
|
|
2020-11-25 18:43:44 +03:00
|
|
|
@app.route("/assert-json/list")
|
|
|
|
def assert_json_list():
|
2022-02-05 08:56:33 +03:00
|
|
|
return Response(
|
|
|
|
"""[
|
2020-11-25 18:43:44 +03:00
|
|
|
{ "id": 1, "name": "Bob"},
|
|
|
|
{ "id": 2, "name": "Bill"}
|
2022-02-05 08:56:33 +03:00
|
|
|
]""",
|
|
|
|
mimetype="application/json",
|
|
|
|
)
|
|
|
|
|
2020-11-25 18:43:44 +03:00
|
|
|
|
2021-12-20 00:56:04 +03:00
|
|
|
@app.route("/assert-json/filter")
|
|
|
|
def assert_json_filter():
|
2022-02-05 08:56:33 +03:00
|
|
|
return Response(
|
|
|
|
"""{
|
2021-12-20 00:56:04 +03:00
|
|
|
"fruit": [
|
|
|
|
{
|
|
|
|
"name": "apple",
|
|
|
|
"price": {
|
|
|
|
"US": 100,
|
|
|
|
"UN": 110
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "grape",
|
|
|
|
"price": {
|
|
|
|
"US": 200,
|
|
|
|
"UN": 150
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2022-02-05 08:56:33 +03:00
|
|
|
}""",
|
|
|
|
mimetype="application/json",
|
|
|
|
)
|