test_events: Use assertLogs to avoid spam in test-backend output.

This commit is contained in:
Mohit Gupta
2020-07-26 05:28:11 +05:30
committed by Tim Abbott
parent 4928b55996
commit 85fcd0ad99

View File

@@ -1882,10 +1882,13 @@ class NormalActionsTest(BaseAction):
with mock.patch('zerver.lib.export.do_export_realm',
return_value=create_dummy_file('test-export.tar.gz')):
with stdout_suppressed():
with stdout_suppressed(), self.assertLogs(level='INFO') as info_logs:
events = self.verify_action(
lambda: self.client_post('/json/export/realm'),
state_change_expected=True, num_events=3)
self.assertTrue(
'INFO:root:Completed data export for zulip in' in info_logs.output[0]
)
# We first notify when an export is initiated,
pending_schema_checker('events[0]', events[0])