From 3b76998d6e91a220a7d413c9149f58f6031d9ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 6 Nov 2006 14:30:32 +0000 Subject: [PATCH] method_id= in clearCache is not part of the API. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11122 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/tests/testERP5Type.py | 30 +++++++++----------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/product/ERP5Type/tests/testERP5Type.py b/product/ERP5Type/tests/testERP5Type.py index 9e95b6df86..2785904f1a 100644 --- a/product/ERP5Type/tests/testERP5Type.py +++ b/product/ERP5Type/tests/testERP5Type.py @@ -370,33 +370,23 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): def test_06_CachingMethod(self, quiet=quiet, run=run_all_test): """Tests Caching methods.""" if not run: return - cached_var1 = cached_var1_orig = 'cached_var1' - cached_var2 = cached_var2_orig = 'cached_var2' + cached_var = cached_var_orig = 'cached_var1' - def _cache1(): - return cached_var1 - def _cache2(): - return cached_var2 + def _cache(): + return cached_var from Products.ERP5Type.Cache import CachingMethod, clearCache - cache1 = CachingMethod(_cache1, id='_cache1') - cache2 = CachingMethod(_cache2, id='_cache2') + cache1 = CachingMethod(_cache, id='testing_cache') - self.assertEquals(cache1(), cached_var1) - self.assertEquals(cache2(), cached_var2) + self.assertEquals(cache(), cached_var) - cached_var1 = 'cached_var1 (modified)' - cached_var2 = 'cached_var2 (modified)' - self.assertEquals(cache1(), cached_var1_orig) + # change the variable + cached_var = 'cached_var (modified)' + # cache hit -> still the old variable + self.assertEquals(cache(), cached_var_orig) - # clearCache with a method argument only clear this cache - clearCache(method_id = '_cache1') - self.assertEquals(cache1(), cached_var1) - self.assertEquals(cache2(), cached_var2_orig) - - # clearCache with no arguments clear all caches clearCache() - self.assertEquals(cache2(), cached_var2) + self.assertEquals(cache(), cached_var) def test_07_afterCloneScript(self, quiet=quiet, run=run_all_test): """manage_afterClone can call a type based script.""" -- 2.30.9