Ejemplo n.º 1
0
 def testCacheRemoval(self):
     """
     If a block is deleted it should also be removed from the cache.
     """
     block = FlatBlockXtd(slug="test", content="CONTENT")
     block.save()
     tpl = template.Template(
         '{% load flatblock_xtd_tags %}{% flatblock_xtd "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))
Ejemplo n.º 2
0
 def testSaveForceUpdate(self):
     block = FlatBlockXtd(slug='missing')
     with self.assertRaises(ValueError):
         block.save(force_update=True)