示例#1
0
 def test_unknown_action(self):
     bundle = MagicMock()
     triggering_item = MockItem(
         bundle,
         "triggering",
         {'triggers': ["mock:triggered:action2"]},
     )
     triggered_item = MockItem(bundle, "triggered", {})
     with self.assertRaises(BundleError):
         deps._inject_canned_actions([triggering_item, triggered_item])
示例#2
0
 def test_injection_ok(self):
     bundle = MagicMock()
     triggering_item1 = MockItem(
         bundle,
         "triggering1",
         {'triggers': ["mock:triggered:action1"]},
     )
     triggering_item2 = MockItem(
         bundle,
         "triggering2",
         {'triggers': ["mock:triggered", "mock:triggered:action1"]},
     )
     triggered_item = MockItem(bundle, "triggered", {})
     items = deps._inject_canned_actions([
         triggering_item1,
         triggering_item2,
         triggered_item,
     ])
     action = items[3]
     self.assertEqual(action.ITEM_TYPE_NAME, 'action')
     self.assertEqual(len(items), 4)