summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook.git@proton.me>2022-09-29 12:43:48 -0500
committerJordan Cook <jordan.cook.git@proton.me>2023-03-01 17:37:59 -0600
commit38bf6a141a162c7b1e0884d223e8ae88694e262d (patch)
treea4d056323f2eea21f2a0b84f7a638c9e58c7a214
parent67886c4988329e244acbe6f9a07f8aa655ce584e (diff)
downloadrequests-cache-orm.tar.gz
WIP: Integration testsorm
-rw-r--r--tests/integration/test_db.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/integration/test_db.py b/tests/integration/test_db.py
new file mode 100644
index 0000000..89ec31f
--- /dev/null
+++ b/tests/integration/test_db.py
@@ -0,0 +1,22 @@
+from sqlalchemy import create_engine
+
+from requests_cache import ALL_METHODS, CachedSession
+from requests_cache.backends import DbCache, DbDict
+from tests.integration.base_cache_test import BaseCacheTest
+from tests.integration.base_storage_test import BaseStorageTest
+
+# class TestDbDict(BaseStorageTest):
+# storage_class = DbDict
+
+
+class TestDbCache(BaseCacheTest):
+ backend_class = DbCache
+
+ def init_session(self, clear=True, **kwargs) -> CachedSession:
+ kwargs.setdefault('allowable_methods', ALL_METHODS)
+ engine = create_engine('postgresql://postgres:hunter2@localhost:5432/postgres')
+ backend = DbCache(engine, **kwargs)
+ if clear:
+ backend.clear()
+
+ return CachedSession(backend=backend, **kwargs)