summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook.git@proton.me>2022-10-28 13:08:06 -0500
committerJordan Cook <jordan.cook.git@proton.me>2022-10-28 17:38:28 -0500
commitcfe381fdae57d1e2f93d5f2732d3ed57fce05b66 (patch)
tree5024cc33e50abd4786a3bd73eb16bb32f9cb5de6 /tests/integration
parent81929b18b11c72dbf7d95b7358b9cb1e0b395c2c (diff)
downloadrequests-cache-cfe381fdae57d1e2f93d5f2732d3ed57fce05b66.tar.gz
Make use of index with SQLiteCache.filter(expired=False)
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/test_sqlite.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/integration/test_sqlite.py b/tests/integration/test_sqlite.py
index 9aeaa3f..06b17cb 100644
--- a/tests/integration/test_sqlite.py
+++ b/tests/integration/test_sqlite.py
@@ -308,11 +308,15 @@ class TestSQLiteCache(BaseCacheTest):
assert session.cache.count(expired=False) == 1
@patch.object(SQLiteDict, 'sorted')
- def test_filter__expired_only(self, mock_sorted):
- """Filtering by expired only should use a more efficient SQL query"""
+ def test_filter__expired(self, mock_sorted):
+ """Filtering by expired should use a more efficient SQL query"""
session = self.init_session()
- session.cache.filter(valid=False, expired=True)
- mock_sorted.assert_called_once_with(expired=True)
+
+ session.cache.filter()
+ mock_sorted.assert_called_with(expired=True)
+
+ session.cache.filter(expired=False)
+ mock_sorted.assert_called_with(expired=False)
def test_sorted(self):
"""Test wrapper method for SQLiteDict.sorted(), with all arguments combined"""