Add test for issue #2823

This commit is contained in:
L. Kärkkäinen 2023-09-20 19:58:44 +01:00
parent a5a9658896
commit 11c841ab4e

View File

@ -178,6 +178,10 @@ def json_app(app):
async def unmodified_handler(request: Request):
return json(JSON_DATA, status=304)
@app.get("/precondition")
async def precondition_handler(request: Request):
return json(JSON_DATA, status=412)
@app.delete("/")
async def delete_handler(request: Request):
return json(None, status=204)
@ -193,6 +197,10 @@ def test_json_response(json_app):
assert response.text == json_dumps(JSON_DATA)
assert response.json == JSON_DATA
request, response = json_app.test_client.get("/precondition")
assert response.status == 412
assert response.json == JSON_DATA
def test_no_content(json_app):
request, response = json_app.test_client.get("/no-content")