

def testTriggerRegistry(self):
    t = triggers.Triggers()
    callback_1 = (lambda : 1)
    callback_2 = (lambda : 2)
    callback_3 = (lambda : 3)
    t.Add('GoodAI', target_1, callback_1)
    t.Add('BadAI', target_2, callback_2)
    self.assertItemsEqual([], t.Calls([bad_ai]))
    self.assertItemsEqual([callback_1], t.Calls([good_ai]))
    self.assertItemsEqual([callback_2], t.Calls([t800]))
    self.assertItemsEqual([callback_1], t.Calls([t1000]))
    meta_t = triggers.Triggers()
    meta_t.Update(t, callback_3)
    self.assertItemsEqual([], meta_t.Calls([bad_ai]))
    self.assertItemsEqual([callback_3], meta_t.Calls([good_ai]))
    self.assertItemsEqual([callback_3], meta_t.Calls([t800]))
    self.assertItemsEqual([callback_3], meta_t.Calls([t1000]))

dataset/ETHPy150Open google/grr/grr/lib/checks/triggers_test.py TriggersTest.testTriggerRegistry/VarMisuse@122/169 `callback_2`->`callback_1`