Commits

Andriy Kornatskyy committed a494ac9

Fixed issue with deleting OnePass key in case namespace is used.

Comments (0)

Files changed (2)

src/wheezy/caching/patterns.py

 
     def __exit__(self, exc_type, exc_value, traceback):
         if self.acquired:
-            self.cache.delete(self.key, self.namespace)
+            self.cache.delete(self.key, 0, self.namespace)
             self.acquired = False
 
 

src/wheezy/caching/tests/test_patterns.py

         self.one_pass.__enter__()
         assert self.one_pass.acquired
         self.one_pass.__exit__(None, None, None)
-        self.mock_cache.delete.assert_called_once_with('key', 'ns')
+        self.mock_cache.delete.assert_called_once_with('key', 0, 'ns')
         assert not self.one_pass.acquired
 
     def test_exit_not_acquired(self):
             'one_pass:key', ANY, 5, 'ns')
         self.mock_create_factory.assert_called_once_with()
         assert not self.mock_cache.set.called
-        self.mock_cache.delete.assert_called_once_with('one_pass:key', 'ns')
+        self.mock_cache.delete.assert_called_once_with(
+            'one_pass:key', 0, 'ns')
 
     def test_no_dependency(self):
         """ Create factory returned value.
             'one_pass:key', ANY, 5, 'ns')
         self.mock_create_factory.assert_called_once_with()
         self.mock_cache.set.assert_called_once_with('key', 'x', 10, 'ns')
-        self.mock_cache.delete.assert_called_once_with('one_pass:key', 'ns')
+        self.mock_cache.delete.assert_called_once_with(
+            'one_pass:key', 0, 'ns')
 
     def test_with_dependency(self):
         """ Create factory returned value.
             'one_pass:key', ANY, 5, 'ns')
         self.mock_create_factory.assert_called_once_with()
         self.mock_cache.set.assert_called_once_with('key', 'x', 10, 'ns')
-        self.mock_cache.delete.assert_called_once_with('one_pass:key', 'ns')
+        self.mock_cache.delete.assert_called_once_with(
+            'one_pass:key', 0, 'ns')
         self.mock_dependency.add.assert_called_once_with('master_key', 'key')
 
     @patch('wheezy.caching.patterns.OnePass')