From 77889ec30410280ef1ec1671b6226a8d0c0444f7 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Mon, 27 Mar 2023 22:46:44 +0100 Subject: Throw all data manipulation code in one place This means that everything now goes through a Store object, which should make testing a little bit easier. --- tests/test_application.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/test_application.py') diff --git a/tests/test_application.py b/tests/test_application.py index 5a7847e..e86d937 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -4,6 +4,7 @@ import pytest from webtest import TestApp import paste.db +import paste.store from paste import __main__, application DB = "file::memory:?cache=shared" @@ -11,7 +12,7 @@ DB = "file::memory:?cache=shared" @pytest.fixture def db(): - with paste.db.connect(DB) as d: + with paste.store.open(DB) as d: yield d @@ -24,7 +25,7 @@ def app(db): @pytest.fixture def token(db): - return b64encode(__main__.generate_token(db)).decode() + return b64encode(db.generate_token()).decode() @pytest.mark.parametrize("method", ["put", "post", "delete"]) @@ -229,7 +230,6 @@ def test_delete(app, token): ) assert res.status == "201 Created" assert res.headers["Location"] == res.request.url - etag = res.headers["ETag"] res = app.delete("/test_key", expect_errors=True) assert res.status == "401 Unauthorized" res = app.delete("/test_key", headers={"Authorization": f"APIKey {token}"}) -- cgit v1.2.3-54-g00ecf