Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
test_realm_export: Use assertLogs in endpoint tests to verify info log.
Mohit Gupta82646e27c2c7
diff --git a/zerver/tests/test_realm_export.py b/zerver/tests/test_realm_export.pyindex 4f5401e6c8f..17ae7de56b6 100644--- a/zerver/tests/test_realm_export.py+++ b/zerver/tests/test_realm_export.py@@ -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]