From 0c02d89bf38afb06c9ae3af44ccc843c48389d21 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sun, 12 Dec 2021 18:41:29 +0000 Subject: [PATCH] export tests: Avoid passing back path_id from setup. --- zerver/tests/test_import_export.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/zerver/tests/test_import_export.py b/zerver/tests/test_import_export.py index 1584f72dd0..131939d8a1 100644 --- a/zerver/tests/test_import_export.py +++ b/zerver/tests/test_import_export.py @@ -158,7 +158,7 @@ class RealmImportExportTest(ZulipTestCase): consent_message_id=consent_message_id, ) - def _setup_export_files(self, user_profile: UserProfile) -> str: + def _setup_export_files(self, user_profile: UserProfile) -> None: realm = user_profile.realm message = most_recent_message(user_profile) url = upload_message_file( @@ -193,8 +193,6 @@ class RealmImportExportTest(ZulipTestCase): realm.refresh_from_db() - return attachment_path_id - """ Tests for export """ @@ -202,13 +200,12 @@ class RealmImportExportTest(ZulipTestCase): def test_export_files_from_local(self) -> None: user = self.example_user("hamlet") realm = user.realm - path_id = self._setup_export_files(user) + self._setup_export_files(user) self._export_realm(realm) data = read_json("attachment.json") self.assert_length(data["zerver_attachment"], 1) - record = data["zerver_attachment"][0] - self.assertEqual(record["path_id"], path_id) + path_id = data["zerver_attachment"][0]["path_id"] # Test uploads fn = export_fn(f"uploads/{path_id}") @@ -280,13 +277,13 @@ class RealmImportExportTest(ZulipTestCase): user = self.example_user("hamlet") realm = user.realm - attachment_path_id = self._setup_export_files(user) + self._setup_export_files(user) self._export_realm(realm) data = read_json("attachment.json") self.assert_length(data["zerver_attachment"], 1) record = data["zerver_attachment"][0] - self.assertEqual(record["path_id"], attachment_path_id) + attachment_path_id = record["path_id"] def check_types(user_profile_id: int, realm_id: int) -> None: self.assertEqual(type(user_profile_id), int)