Example #1
0
 def test_delete_removes_item_from_storage(self):
     storage = {"foo": "bar"}
     cache = InMemoryCache(storage)
     d = cache.delete("foo")
     self.successResultOf(d)
     self.assertEqual(storage, {})
Example #2
0
 def test_delete_returns_true_when_key_is_present(self):
     cache = InMemoryCache({"foo": "bar"})
     d = cache.delete("foo")
     self.assertTrue(self.successResultOf(d))
Example #3
0
 def test_delete_returns_false_when_is_not_present(self):
     cache = InMemoryCache({})
     d = cache.delete("foo")
     self.assertFalse(self.successResultOf(d))
Example #4
0
 def test_delete_returns_false_when_all_return_false(self):
     c1 = InMemoryCache({})
     c2 = InMemoryCache({})
     cache = MultiCache([c1, c2])
     d = cache.delete("foo")
     self.assertFalse(self.successResultOf(d))
Example #5
0
 def test_delete_returns_true_when_any_return_true(self):
     c1 = InMemoryCache({})
     c2 = InMemoryCache({"foo": "bar"})
     cache = MultiCache([c1, c2])
     d = cache.delete("foo")
     self.assertTrue(self.successResultOf(d))
Example #6
0
 def test_delete_removes_item_from_storage(self):
     storage = {"foo": "bar"}
     cache = InMemoryCache(storage)
     d = cache.delete("foo")
     self.successResultOf(d)
     self.assertEqual(storage, {})
Example #7
0
 def test_delete_returns_false_when_is_not_present(self):
     cache = InMemoryCache({})
     d = cache.delete("foo")
     self.assertFalse(self.successResultOf(d))
Example #8
0
 def test_delete_returns_true_when_key_is_present(self):
     cache = InMemoryCache({"foo": "bar"})
     d = cache.delete("foo")
     self.assertTrue(self.successResultOf(d))