test/unittest_predicates.py
changeset 9582 46ed25d38fe2
parent 9152 b0155bfd4e17
child 9653 ac723e09704f
--- a/test/unittest_predicates.py	Mon Mar 24 16:38:57 2014 +0100
+++ b/test/unittest_predicates.py	Mon Mar 24 11:57:23 2014 +0100
@@ -19,6 +19,7 @@
 
 from operator import eq, lt, le, gt
 from logilab.common.testlib import TestCase, unittest_main
+from logilab.common.decorators import clear_cache
 
 from cubicweb import Binary
 from cubicweb.devtools.testlib import CubicWebTC
@@ -96,6 +97,8 @@
         self._commit()
         self.assertEqual(self.adapter.state, 'validated')
 
+        clear_cache(self.rset, 'get_entity')
+
         selector = is_in_state('created')
         self.assertEqual(selector(None, self.req, rset=self.rset), 0)
         selector = is_in_state('validated')
@@ -109,6 +112,8 @@
         self._commit()
         self.assertEqual(self.adapter.state, 'abandoned')
 
+        clear_cache(self.rset, 'get_entity')
+
         selector = is_in_state('created')
         self.assertEqual(selector(None, self.req, rset=self.rset), 0)
         selector = is_in_state('validated')
@@ -139,6 +144,8 @@
         self._commit()
         self.assertEqual(self.adapter.state, 'validated')
 
+        clear_cache(self.rset, 'get_entity')
+
         selector = on_transition("validate")
         self.assertEqual(selector(None, self.req, rset=self.rset), 1)
         selector = on_transition("validate", "forsake")
@@ -150,6 +157,8 @@
         self._commit()
         self.assertEqual(self.adapter.state, 'abandoned')
 
+        clear_cache(self.rset, 'get_entity')
+
         selector = on_transition("validate")
         self.assertEqual(selector(None, self.req, rset=self.rset), 0)
         selector = on_transition("validate", "forsake")