def test_cache(self):
     self.assertIsNone(get_cache_version())
     self.assertIsNone(get_cached_manifest())
     set_cached_manifest("ciao")
     self.assertEqual(get_cache_version(), 1)
     self.assertEqual(get_cached_manifest(), "ciao")
     reset_cache_manifest()
     set_cached_value("nociao", 1)
     self.assertEqual(get_cached_manifest(), "ciao")
     self.assertEqual(get_cache_version(), 2)
 def get_manifest(self, update=False):
     """
     Either get the manifest file out of the cache or render it and save in
     the cache.
     """
     if not is_manifest_clean() and update:
         self.context = {
             'version': self.get_version_timestamp(),
             'date': datetime.fromtimestamp(self.get_version_timestamp()/1000000).isoformat(),
             'cached_urls': sorted(self.get_cached_urls()),
             'network_urls': sorted(self.get_network_urls()),
             'fallback_urls': self.get_fallback_urls(),
         }
         context = RequestContext(self.request, self.context)
         manifest = render_to_string(self._template, context_instance=context)
         set_cached_manifest(manifest)
         return manifest
     else:
         return get_cached_manifest()