diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-03-27 20:11:37 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-03-27 20:11:37 +0100 |
commit | 3a9629e49b4c7e1d10c89bbffa04d18e96948116 (patch) | |
tree | d7e3fe35141fd56f6e2446de3546a052a7c197cf /tests | |
parent | 5af2720086adc5337150259c7a6a37ade3770344 (diff) | |
download | paste-3a9629e49b4c7e1d10c89bbffa04d18e96948116.tar.gz paste-3a9629e49b4c7e1d10c89bbffa04d18e96948116.tar.xz paste-3a9629e49b4c7e1d10c89bbffa04d18e96948116.zip |
POST request support
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_application.py | 17 |
1 files changed, 17 insertions, 0 deletions
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 |