def test_one_pass(): plugin = ConsoleOutputPlugin() dispatcher = EventDispatcher() plugin.register(dispatcher) graph = bonobo.Graph() context = MagicMock(spec=GraphExecutionContext(graph)) dispatcher.dispatch(events.START, events.ExecutionEvent(context)) dispatcher.dispatch(events.TICK, events.ExecutionEvent(context)) dispatcher.dispatch(events.STOPPED, events.ExecutionEvent(context)) plugin.unregister(dispatcher)
def test_event_object(): # Same logic as above. c = Mock() e = events.ExecutionEvent(c) assert e.context is c
def dispatch(self, name): self.dispatcher.dispatch(name, events.ExecutionEvent(self))