Пример #1
0
    def test_producer_composite_event_triggers_forward(self):
        forward = ActionForwarder(NoAction(bool_return=True))
        sub = StubForwarderSubscriber()
        forward.subscribe(sub)

        c_event = generate_composite_event(NAME_A)

        forward.on_accepted_producer_event(c_event)
        forward.setup()
        forward.loop()

        self.assertListEqual([c_event], sub.success)
Пример #2
0
    def test_forward_failure(self):
        comp_event = generate_composite_event(NAME_A)
        action_event = NoAction().execute(comp_event)

        forward = ActionForwarder(NoAction(bool_return=False))

        sub = StubForwarderSubscriber()
        forward.subscribe(sub)

        forward.on_producer_action(action_event)
        forward.setup()
        forward.loop()

        self.assertListEqual([action_event], sub.failure)