Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
import tests: Pass realm to _setup_export_files.
Vishnu KSd0220fc5fc14
diff --git a/zerver/tests/test_import_export.py b/zerver/tests/test_import_export.pyindex 2e11deb986f..a51bf9218da 100644--- a/zerver/tests/test_import_export.py+++ b/zerver/tests/test_import_export.py@@ -253,8 +253,7 @@ class ImportExportTest(ZulipTestCase):result['realm_icons_dir_records'] = read_file(os.path.join('realm_icons', 'records.json'))return result- def _setup_export_files(self) -> Tuple[str, str, str, bytes]:- realm = Realm.objects.get(string_id='zulip')+ def _setup_export_files(self, realm: Realm) -> Tuple[str, str, str, bytes]:message = Message.objects.all()[0]user_profile = message.senderurl = upload_message_file('dummy.txt', len(b'zulip!'), 'text/plain', b'zulip!', user_profile)@@ -295,6 +294,8 @@ class ImportExportTest(ZulipTestCase):message.sender.avatar_source = 'U'message.sender.save()+ realm.refresh_from_db()+return attachment_path_id, emoji_path, original_avatar_path_id, test_image"""@@ -303,7 +304,7 @@ class ImportExportTest(ZulipTestCase):def test_export_files_from_local(self) -> None:realm = Realm.objects.get(string_id='zulip')- path_id, emoji_path, original_avatar_path_id, test_image = self._setup_export_files()+ path_id, emoji_path, original_avatar_path_id, test_image = self._setup_export_files(realm)full_data = self._export_realm(realm)data = full_data['attachment']@@ -361,7 +362,7 @@ class ImportExportTest(ZulipTestCase):settings.S3_AVATAR_BUCKET)realm = Realm.objects.get(string_id='zulip')- attachment_path_id, emoji_path, original_avatar_path_id, test_image = self._setup_export_files()+ attachment_path_id, emoji_path, original_avatar_path_id, test_image = self._setup_export_files(realm)full_data = self._export_realm(realm)data = full_data['attachment']@@ -984,10 +985,8 @@ class ImportExportTest(ZulipTestCase):type_id=huddle_object.id).id)def test_import_files_from_local(self) -> None:-realm = Realm.objects.get(string_id='zulip')- self._setup_export_files()- realm.refresh_from_db()+ self._setup_export_files(realm)self._export_realm(realm)@@ -1049,8 +1048,7 @@ class ImportExportTest(ZulipTestCase):settings.S3_AVATAR_BUCKET)realm = Realm.objects.get(string_id='zulip')- self._setup_export_files()- realm.refresh_from_db()+ self._setup_export_files(realm)self._export_realm(realm)with self.settings(BILLING_ENABLED=False):@@ -1133,7 +1131,7 @@ class ImportExportTest(ZulipTestCase):realm = get_realm('zulip')do_change_plan_type(realm, Realm.LIMITED)- self._setup_export_files()+ self._setup_export_files(realm)self._export_realm(realm)with patch('logging.info'):