mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
test_realm_export: Use assertLogs in endpoint tests to verify info log.
This is to avoid spam in test-backend output.
This commit is contained in:
@@ -45,8 +45,10 @@ class RealmExportTest(ZulipTestCase):
|
||||
# Test the export logic.
|
||||
with patch('zerver.lib.export.do_export_realm',
|
||||
return_value=tarball_path) as mock_export:
|
||||
with self.settings(LOCAL_UPLOADS_DIR=None), stdout_suppressed():
|
||||
with self.settings(LOCAL_UPLOADS_DIR=None), stdout_suppressed(), \
|
||||
self.assertLogs(level='INFO') as info_logs:
|
||||
result = self.client_post('/json/export/realm')
|
||||
self.assertTrue('INFO:root:Completed data export for zulip in ' in info_logs.output[0])
|
||||
self.assert_json_success(result)
|
||||
self.assertFalse(os.path.exists(tarball_path))
|
||||
args = mock_export.call_args_list[0][1]
|
||||
@@ -104,8 +106,9 @@ class RealmExportTest(ZulipTestCase):
|
||||
# Test the export logic.
|
||||
with patch('zerver.lib.export.do_export_realm',
|
||||
return_value=tarball_path) as mock_export:
|
||||
with stdout_suppressed():
|
||||
with stdout_suppressed(), self.assertLogs(level='INFO') as info_logs:
|
||||
result = self.client_post('/json/export/realm')
|
||||
self.assertTrue('INFO:root:Completed data export for zulip in ' in info_logs.output[0])
|
||||
self.assert_json_success(result)
|
||||
self.assertFalse(os.path.exists(tarball_path))
|
||||
args = mock_export.call_args_list[0][1]
|
||||
|
||||
Reference in New Issue
Block a user