summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook@pioneer.com>2021-10-23 10:53:39 -0500
committerJordan Cook <jordan.cook@pioneer.com>2021-10-23 11:13:40 -0500
commit59012f090d6e2146e2d6a7ed75c2fcaf3fa8a728 (patch)
tree7e31b25096254bbcb57b3f996587bc81e27df0a1
parentf43c0cb1f03b579f2620673ce80ee14c785dfd6f (diff)
downloadrequests-cache-59012f090d6e2146e2d6a7ed75c2fcaf3fa8a728.tar.gz
Add tests for memory (plain dict) backend
-rw-r--r--requests_cache/backends/__init__.py2
-rw-r--r--tests/integration/test_memory.py20
2 files changed, 21 insertions, 1 deletions
diff --git a/requests_cache/backends/__init__.py b/requests_cache/backends/__init__.py
index d91b8ad..69fca59 100644
--- a/requests_cache/backends/__init__.py
+++ b/requests_cache/backends/__init__.py
@@ -5,7 +5,7 @@ from logging import getLogger
from typing import Callable, Dict, Iterable, Optional, Type, Union
from .. import get_placeholder_class, get_valid_kwargs
-from .base import BaseCache, BaseStorage
+from .base import BaseCache, BaseStorage, DictStorage
# Backend-specific keyword arguments equivalent to 'cache_name'
CACHE_NAME_KWARGS = ['db_path', 'db_name', 'namespace', 'table_name']
diff --git a/tests/integration/test_memory.py b/tests/integration/test_memory.py
new file mode 100644
index 0000000..2c4375d
--- /dev/null
+++ b/tests/integration/test_memory.py
@@ -0,0 +1,20 @@
+from requests_cache.backends import BaseCache, DictStorage
+from tests.integration.base_cache_test import BaseCacheTest
+from tests.integration.base_storage_test import BaseStorageTest
+
+
+class TestMemoryDict(BaseStorageTest):
+ storage_class = DictStorage
+
+ def init_cache(self, clear=True, **kwargs):
+ cache = self.storage_class(**kwargs)
+ if clear:
+ cache.clear()
+ return cache
+
+ def test_same_settings(self):
+ """This test from base class doesn't apply here"""
+
+
+class TestMemoryCache(BaseCacheTest):
+ backend_class = BaseCache