hurl/integration/tests_ok/multilines.py

53 lines
1.4 KiB
Python
Raw Normal View History

from app import app
from flask import request
2021-07-01 21:02:47 +03:00
@app.route("/multilines/plain-text", methods=["POST"])
2022-11-15 14:00:29 +03:00
def multilines_plain_text():
expected_body = "line1\nline2\nline3\n"
body_in = request.data.decode("utf-8")
assert expected_body == body_in
return expected_body
2022-11-15 14:00:29 +03:00
@app.route("/multilines/json", methods=["POST"])
2022-11-15 14:00:29 +03:00
def multilines_json():
expected_body = """\
2022-11-15 14:00:29 +03:00
{
"foo": "bar"
"baz": 123456
}
"""
body_in = request.data.decode("utf-8")
assert expected_body == body_in
return expected_body
2022-11-15 14:00:29 +03:00
@app.route("/multilines/xml", methods=["POST"])
2022-11-15 14:00:29 +03:00
def multilines_xml():
expected_body = """\
2022-11-15 14:00:29 +03:00
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
2022-11-15 14:00:29 +03:00
</catalog>
"""
body_in = request.data.decode("utf-8")
assert expected_body == body_in
return expected_body
2022-11-15 14:00:29 +03:00
@app.route("/multilines/graphql", methods=["POST"])
2022-11-15 14:00:29 +03:00
def multilines_graphql():
expected_body = r'{"query":"{\n hero {\n name\n # Queries can have comments!\n friends {\n name\n }\n }\n}"}'
body_in = request.data.decode("utf-8")
assert expected_body == body_in
return expected_body