forked from p15670423/monkey
Common: Remove subscribe_all_event_types()
https://github.com/guardicore/monkey/pull/2182#discussion_r942427831
This commit is contained in:
parent
87cbdd9fb8
commit
43e45e14ad
|
@ -24,11 +24,6 @@ class PyPubSubEventQueue(IEventQueue):
|
||||||
# pypubsub.pub.subscribe needs a string as the topic/event name
|
# pypubsub.pub.subscribe needs a string as the topic/event name
|
||||||
self._pypubsub_publisher.subscribe(listener=subscriber, topicName=event_type.__name__)
|
self._pypubsub_publisher.subscribe(listener=subscriber, topicName=event_type.__name__)
|
||||||
|
|
||||||
def subscribe_all_event_types(self, subscriber: Callable[[AbstractEvent], None]):
|
|
||||||
self._pypubsub_publisher.subscribe(
|
|
||||||
listener=subscriber, topicName=INTERNAL_ALL_EVENT_TYPES_TOPIC
|
|
||||||
)
|
|
||||||
|
|
||||||
def subscribe_tag(self, tag: str, subscriber: Callable[[AbstractEvent], None]):
|
def subscribe_tag(self, tag: str, subscriber: Callable[[AbstractEvent], None]):
|
||||||
self._pypubsub_publisher.subscribe(listener=subscriber, topicName=tag)
|
self._pypubsub_publisher.subscribe(listener=subscriber, topicName=tag)
|
||||||
|
|
||||||
|
|
|
@ -92,12 +92,3 @@ def test_subscribe_tags(subscriber_1, subscriber_2, subscriber_1_calls, subscrib
|
||||||
|
|
||||||
assert subscriber_1_calls == [EVENT_TAG_1]
|
assert subscriber_1_calls == [EVENT_TAG_1]
|
||||||
assert subscriber_2_calls == [EVENT_TAG_2]
|
assert subscriber_2_calls == [EVENT_TAG_2]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("subscriber_1", "subscriber_1_calls")
|
|
||||||
def test_subscribe_all_event_types(subscriber_1, subscriber_1_calls):
|
|
||||||
pypubsub_event_queue.subscribe_all_event_types(subscriber_1)
|
|
||||||
pypubsub_event_queue.publish(EventType)
|
|
||||||
pypubsub_event_queue.publish(EventType)
|
|
||||||
|
|
||||||
assert subscriber_1_calls == [INTERNAL_ALL_EVENT_TYPES_TOPIC, INTERNAL_ALL_EVENT_TYPES_TOPIC]
|
|
||||||
|
|
Loading…
Reference in New Issue