def test_hookbind_param(self): trigger = triggers.get('test_hooks/test_0') def test_callback(matchable, param): self.assertEqual(True, param['test']) trigger.bind(test_callback, {'test': True}) trigger.call_methods()
def test_hookbind_noparam(self): trigger = triggers.get('test_hooks/test_0') def test_callback(matchable): pass trigger.bind(test_callback) trigger.call_methods()
def test_hook_multi(self): trigger = triggers.get('test_hooks/test_0') def test_callback_1(matchable, param): self.assertEqual(True, param['test']) def test_callback_2(matchable, param): self.assertEqual(False, param['an_arg']) trigger.bind(test_callback_1, {'test': True}) trigger.bind(test_callback_2, {'an_arg': False}) trigger.call_methods()
def test_fail_get_trigger(self): trigger = triggers.get('test_get/fail_30') self.assertEqual(trigger, None)
def test_get_subtrigger(self): trigger = triggers.get('test_get/subgroup/test_42') self.assertEqual(trigger.name, 'test_42')
def test_get_subgroup(self): new_subgroup = triggers.get('test_get/subgroup') self.assertEqual(new_subgroup.name, 'subgroup')
def test_get_trigger(self): trigger = triggers.get('test_get/test_30') self.assertEqual(trigger.name, 'test_30')
def test_get_group(self): newgroup = triggers.get('test_get') self.assertEqual(newgroup.name, 'test_get')
def test_child_removal(self): triggers.get('dummy/subdummy').destroy() self.assertIn('dummy', triggers.groups) self.assertEqual(len(apps.groups['dummyapp']), 1)
def test_parent_removal(self): triggers.get('dummy').destroy() self.assertNotIn('dummy', triggers.groups) self.assertEqual(len(apps.groups['dummyapp']), 0)
def test_subgroup_ownership(self): group = triggers.get('dummy/subdummy') self.assertEqual('dummyapp', group.app)