[repo test] fix test broken by c2452cd57026 by using proper fake session
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 11 May 2011 09:39:51 +0200
changeset 7361 6baa4f430c9b
parent 7360 dbff01dd3c3c
child 7364 aff846ce1050
[repo test] fix test broken by c2452cd57026 by using proper fake session
server/test/unittest_hook.py
--- a/server/test/unittest_hook.py	Wed May 11 09:38:44 2011 +0200
+++ b/server/test/unittest_hook.py	Wed May 11 09:39:51 2011 +0200
@@ -23,7 +23,7 @@
 from logilab.common.testlib import TestCase, unittest_main, mock_object
 
 
-from cubicweb.devtools import TestServerConfiguration
+from cubicweb.devtools import TestServerConfiguration, fake
 from cubicweb.devtools.testlib import CubicWebTC
 from cubicweb.server import hook
 from cubicweb.hooks import integrity, syncschema
@@ -124,10 +124,8 @@
     def test_call_hook(self):
         self.o.register(AddAnyHook)
         dis = set()
-        cw = mock_object(vreg=self.vreg,
-                         set_read_security=lambda *a,**k: None,
-                         set_write_security=lambda *a,**k: None,
-                         is_hook_activated=lambda x, cls: cls.category not in dis)
+        cw = fake.FakeSession()
+        cw.is_hook_activated = lambda cls: cls.category not in dis
         self.assertRaises(HookCalled,
                           self.o.call_hooks, 'before_add_entity', cw)
         dis.add('cat1')