def test_subscribers_get_called_on_publish(): bus = Bus() def on_1(data): global called_1 called_1 = True def on_2(data): global called_2 called_2 = True bus.subscribe("some_message", on_1) bus.subscribe("some_message", on_2) bus.publish("some_message", {}) assert called_1 assert called_2
def test_can_publish_a_message_with_no_subscribers(): bus = Bus() bus.publish("some_message", {})