def testDisable(self): caching.cache_set('disabled', value=False) v = caching.cache_get('disabled') self.assertEqual(v, False) caching.cache_enable(False) caching.cache_set('disabled', value=True) try: caching.cache_get('disabled') self.fail('should have raised NotCachedError') except caching.NotCachedError, nce: key = caching.cache_key('disabled') self.assertEqual(nce.key, key)
def cache_key(self, *args, **kwargs): keys = [self.__class__.__name__, self] keys.extend(args) return caching.cache_key(keys, **kwargs)
def testPairedDualKey(self): v = caching.cache_key('test', 3, more='yes') self.assertEqual(v, caching.CACHE_PREFIX + '::test::3::more::yes')
def testDualKey(self): v = caching.cache_key('test', 2) self.assertEqual(v, caching.CACHE_PREFIX + '::test::2')
def testSimpleKey(self): v = caching.cache_key('test') self.assertEqual(v, caching.CACHE_PREFIX + '::test')