def test_delete_removes_item_from_storage(self): storage = {"foo": "bar"} cache = InMemoryCache(storage) d = cache.delete("foo") self.successResultOf(d) self.assertEqual(storage, {})
def test_delete_returns_true_when_key_is_present(self): cache = InMemoryCache({"foo": "bar"}) d = cache.delete("foo") self.assertTrue(self.successResultOf(d))
def test_delete_returns_false_when_is_not_present(self): cache = InMemoryCache({}) d = cache.delete("foo") self.assertFalse(self.successResultOf(d))
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))
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))