UT: Replace fn() with SubscriberSpy callable

This commit is contained in:
Mike Salvatore 2022-09-06 12:59:22 -04:00
parent e1e119c27a
commit 59c58b3115
1 changed files with 7 additions and 6 deletions

View File

@ -19,14 +19,15 @@ def event_queue() -> IIslandEventQueue:
@pytest.fixture
def event_queue_subscriber() -> Callable[..., None]:
def fn(topic=pub.AUTO_TOPIC):
fn.call_count += 1
fn.call_topics |= {topic.getName()}
class SubscriberSpy:
call_count = 0
call_topics = set()
fn.call_count = 0
fn.call_topics = set()
def __call__(self, topic=pub.AUTO_TOPIC):
self.call_count += 1
self.call_topics |= {topic.getName()}
return fn
return SubscriberSpy()
def test_subscribe_publish__no_event_body(