From 3a9629e49b4c7e1d10c89bbffa04d18e96948116 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Mon, 27 Mar 2023 20:11:37 +0100 Subject: POST request support --- tests/test_application.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') diff --git a/tests/test_application.py b/tests/test_application.py index a7d6861..5a7847e 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -238,3 +238,20 @@ def test_delete(app, token): "/test_key", headers={"Authorization": f"APIKey {token}"}, expect_errors=True ) assert res.status == "404 Not Found" + + +def test_post(app, token): + res = app.post( + "/test_key", + "Hello, World!", + headers={"Content-Type": "text/plain", "Authorization": f"APIKey {token}"}, + ) + assert res.status == "201 Created" + assert res.headers["Location"] != res.request.url + print(res.headers["Location"]) + print(res.request.url) + assert res.headers["Location"].startswith(res.request.url) + etag = res.headers["ETag"] + res = app.get(res.headers["Location"]) + assert res.status == "200 OK" + assert res.headers["ETag"] == etag -- cgit v1.2.3-54-g00ecf