mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
tests: Assert num_events in tornado_redirected_to_list.
This commit is contained in:
committed by
Tim Abbott
parent
8960e64443
commit
481a890ec5
@@ -1258,7 +1258,9 @@ Output:
|
||||
self.assertFalse(validation_func(guest_user))
|
||||
|
||||
@contextmanager
|
||||
def tornado_redirected_to_list(self, lst: List[Mapping[str, Any]]) -> Iterator[None]:
|
||||
def tornado_redirected_to_list(
|
||||
self, lst: List[Mapping[str, Any]], expected_num_events: int = 1
|
||||
) -> Iterator[None]:
|
||||
real_event_queue_process_notification = django_tornado_api.process_notification
|
||||
django_tornado_api.process_notification = lambda notice: lst.append(notice)
|
||||
# process_notification takes a single parameter called 'notice'.
|
||||
@@ -1269,6 +1271,8 @@ Output:
|
||||
yield
|
||||
django_tornado_api.process_notification = real_event_queue_process_notification
|
||||
|
||||
self.assert_length(lst, expected_num_events)
|
||||
|
||||
|
||||
class WebhookTestCase(ZulipTestCase):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user