tests: Assert num_events in tornado_redirected_to_list.

This commit is contained in:
Abhijeet Prasad Bodas
2021-05-27 19:23:22 +05:30
committed by Tim Abbott
parent 8960e64443
commit 481a890ec5
6 changed files with 40 additions and 70 deletions

View File

@@ -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):
"""