cubicweb/server/test/unittest_hook.py
changeset 12035 2fcb9339f69a
parent 12027 c62c80f20a82
child 12036 4c2c731f9190
equal deleted inserted replaced
12034:e7e469d0539b 12035:2fcb9339f69a
   110         self.assertEqual(str(cm.exception), 'bad event b on %s._Hook' % __name__)
   110         self.assertEqual(str(cm.exception), 'bad event b on %s._Hook' % __name__)
   111 
   111 
   112     def test_call_hook(self):
   112     def test_call_hook(self):
   113         self.o.register(AddAnyHook)
   113         self.o.register(AddAnyHook)
   114         dis = set()
   114         dis = set()
   115         cw = fake.FakeSession()
   115         cw = fake.FakeConnection()
   116         cw.is_hook_activated = lambda cls: cls.category not in dis
   116         cw.is_hook_activated = lambda cls: cls.category not in dis
   117         self.assertRaises(HookCalled,
   117         self.assertRaises(HookCalled,
   118                           self.o.call_hooks, 'before_add_entity', cw)
   118                           self.o.call_hooks, 'before_add_entity', cw)
   119         dis.add('cat1')
   119         dis.add('cat1')
   120         self.o.call_hooks('before_add_entity', cw) # disabled hooks category, not called
   120         self.o.call_hooks('before_add_entity', cw) # disabled hooks category, not called