def testCacheRemoval(self): """ If a block is deleted it should also be removed from the cache. """ block = FlatBlock(slug="test", content="CONTENT") block.save() tpl = template.Template( '{% load flatblock_tags %}{% flatblock "test" 100 %}') # We fill the cache by rendering the block tpl.render(template.Context({})) cache_key = ':'.join(['test', 'False', 'flatblocks/flatblock.html']) self.assertNotEqual(None, cache.get(cache_key)) block.delete()
def testCacheRemoval(self): """ If a block is deleted it should also be removed from the cache. """ block = FlatBlock(slug="test", content="CONTENT") block.save() tpl = template.Template( '{% load flatblock_tags %}{% flatblock "test" 100 %}') # We fill the cache by rendering the block tpl.render(template.Context({})) cache_key = "%stest" % settings.CACHE_PREFIX self.assertNotEqual(None, cache.get(cache_key)) block.delete() self.assertEqual(None, cache.get(cache_key))