Esempio n. 1
0
 def test_benefits_are_cached(self):
     get_cached_tree_benefits(self.filter, lambda: self.benefits)
     benefits = get_cached_tree_benefits(self.filter, lambda: 'others')
     self.assertEqual(benefits, self.benefits)
Esempio n. 2
0
 def test_updating_eco_rev_busts_benefit_cache(self):
     get_cached_tree_benefits(self.filter, lambda: self.benefits)
     self.filter.instance.update_eco_rev()
     benefits = get_cached_tree_benefits(self.filter, lambda: 'others')
     self.assertEqual(benefits, 'others')
Esempio n. 3
0
 def benefits_for_filter(self, instance, item_filter):
     return get_cached_tree_benefits(
         item_filter, lambda: self._get_benefits(item_filter))