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

@@ -166,7 +166,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
self.login("hamlet")
self.assert_num_bots_equal(0)
events: List[Mapping[str, Any]] = []
with self.tornado_redirected_to_list(events):
with self.tornado_redirected_to_list(events, expected_num_events=2):
result = self.create_bot()
self.assert_num_bots_equal(1)
@@ -332,7 +332,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
self.login_user(user)
self.assert_num_bots_equal(0)
events: List[Mapping[str, Any]] = []
with self.tornado_redirected_to_list(events):
with self.tornado_redirected_to_list(events, expected_num_events=2):
result = self.create_bot()
self.assert_num_bots_equal(1)
@@ -386,7 +386,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
"principals": '["' + iago.email + '"]',
}
events: List[Mapping[str, Any]] = []
with self.tornado_redirected_to_list(events):
with self.tornado_redirected_to_list(events, expected_num_events=3):
result = self.common_subscribe_to_streams(hamlet, ["Rome"], request_data)
self.assert_json_success(result)
@@ -403,7 +403,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
"principals": '["hambot-bot@zulip.testserver"]',
}
events_bot: List[Mapping[str, Any]] = []
with self.tornado_redirected_to_list(events_bot):
with self.tornado_redirected_to_list(events_bot, expected_num_events=2):
result = self.common_subscribe_to_streams(hamlet, ["Rome"], bot_request_data)
self.assert_json_success(result)
@@ -424,7 +424,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
self.assert_num_bots_equal(0)
events: List[Mapping[str, Any]] = []
with self.tornado_redirected_to_list(events):
with self.tornado_redirected_to_list(events, expected_num_events=2):
result = self.create_bot(default_sending_stream="Denmark")
self.assert_num_bots_equal(1)
self.assertEqual(result["default_sending_stream"], "Denmark")
@@ -496,7 +496,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
self.assert_num_bots_equal(0)
events: List[Mapping[str, Any]] = []
with self.tornado_redirected_to_list(events):
with self.tornado_redirected_to_list(events, expected_num_events=2):
result = self.create_bot(default_events_register_stream="Denmark")
self.assert_num_bots_equal(1)
self.assertEqual(result["default_events_register_stream"], "Denmark")