--- a/server/test/unittest_hook.py Mon Mar 08 18:31:36 2010 +0100
+++ b/server/test/unittest_hook.py Mon Mar 08 19:02:35 2010 +0100
@@ -108,13 +108,17 @@
def test_call_hook(self):
self.o.register(AddAnyHook)
- cw = mock_object(vreg=self.vreg)
- self.assertRaises(HookCalled, self.o.call_hooks, 'before_add_entity', cw)
+ dis = set()
+ cw = mock_object(vreg=self.vreg,
+ is_hook_activated=lambda x, cls: cls.category not in dis)
+ self.assertRaises(HookCalled,
+ self.o.call_hooks, 'before_add_entity', cw)
self.o.call_hooks('before_delete_entity', cw) # nothing to call
- config.disabled_hooks_categories.add('cat1')
+ dis.add('cat1')
self.o.call_hooks('before_add_entity', cw) # disabled hooks category, not called
- config.disabled_hooks_categories.remove('cat1')
- self.assertRaises(HookCalled, self.o.call_hooks, 'before_add_entity', cw)
+ dis.remove('cat1')
+ self.assertRaises(HookCalled,
+ self.o.call_hooks, 'before_add_entity', cw)
self.o.unregister(AddAnyHook)
self.o.call_hooks('before_add_entity', cw) # nothing to call