equal
deleted
inserted
replaced
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 |