mirror of https://github.com/zulip/zulip.git
tests: Avoid returning original_avatar_path_id.
The way we check for avatars is kind of clumsy for realms. Ideally we would just check all users in the realm.
This commit is contained in:
parent
dbf1ae989d
commit
fd94ba1579
|
@ -158,7 +158,7 @@ class RealmImportExportTest(ZulipTestCase):
|
||||||
consent_message_id=consent_message_id,
|
consent_message_id=consent_message_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _setup_export_files(self, user_profile: UserProfile) -> Tuple[str, str, str]:
|
def _setup_export_files(self, user_profile: UserProfile) -> Tuple[str, str]:
|
||||||
realm = user_profile.realm
|
realm = user_profile.realm
|
||||||
message = most_recent_message(user_profile)
|
message = most_recent_message(user_profile)
|
||||||
url = upload_message_file(
|
url = upload_message_file(
|
||||||
|
@ -171,8 +171,6 @@ class RealmImportExportTest(ZulipTestCase):
|
||||||
message=message,
|
message=message,
|
||||||
is_message_realm_public=True,
|
is_message_realm_public=True,
|
||||||
)
|
)
|
||||||
avatar_path_id = user_avatar_path(user_profile)
|
|
||||||
original_avatar_path_id = avatar_path_id + ".original"
|
|
||||||
|
|
||||||
emoji_path = RealmEmoji.PATH_ID_TEMPLATE.format(
|
emoji_path = RealmEmoji.PATH_ID_TEMPLATE.format(
|
||||||
realm_id=realm.id,
|
realm_id=realm.id,
|
||||||
|
@ -200,7 +198,7 @@ class RealmImportExportTest(ZulipTestCase):
|
||||||
|
|
||||||
realm.refresh_from_db()
|
realm.refresh_from_db()
|
||||||
|
|
||||||
return attachment_path_id, emoji_path, original_avatar_path_id
|
return attachment_path_id, emoji_path
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Tests for export
|
Tests for export
|
||||||
|
@ -209,7 +207,7 @@ class RealmImportExportTest(ZulipTestCase):
|
||||||
def test_export_files_from_local(self) -> None:
|
def test_export_files_from_local(self) -> None:
|
||||||
user = self.example_user("hamlet")
|
user = self.example_user("hamlet")
|
||||||
realm = user.realm
|
realm = user.realm
|
||||||
path_id, emoji_path, original_avatar_path_id = self._setup_export_files(user)
|
path_id, emoji_path = self._setup_export_files(user)
|
||||||
self._export_realm(realm)
|
self._export_realm(realm)
|
||||||
|
|
||||||
data = read_json("attachment.json")
|
data = read_json("attachment.json")
|
||||||
|
@ -268,6 +266,7 @@ class RealmImportExportTest(ZulipTestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test avatars
|
# Test avatars
|
||||||
|
original_avatar_path_id = user_avatar_path(user) + ".original"
|
||||||
fn = export_fn(f"avatars/{original_avatar_path_id}")
|
fn = export_fn(f"avatars/{original_avatar_path_id}")
|
||||||
with open(fn, "rb") as fb:
|
with open(fn, "rb") as fb:
|
||||||
fn_data = fb.read()
|
fn_data = fb.read()
|
||||||
|
@ -288,7 +287,6 @@ class RealmImportExportTest(ZulipTestCase):
|
||||||
(
|
(
|
||||||
attachment_path_id,
|
attachment_path_id,
|
||||||
emoji_path,
|
emoji_path,
|
||||||
original_avatar_path_id,
|
|
||||||
) = self._setup_export_files(user)
|
) = self._setup_export_files(user)
|
||||||
self._export_realm(realm)
|
self._export_realm(realm)
|
||||||
|
|
||||||
|
@ -351,6 +349,7 @@ class RealmImportExportTest(ZulipTestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test avatars
|
# Test avatars
|
||||||
|
original_avatar_path_id = user_avatar_path(user) + ".original"
|
||||||
fn = export_fn(f"avatars/{original_avatar_path_id}")
|
fn = export_fn(f"avatars/{original_avatar_path_id}")
|
||||||
with open(fn, "rb") as file:
|
with open(fn, "rb") as file:
|
||||||
fn_data = file.read()
|
fn_data = file.read()
|
||||||
|
|
Loading…
Reference in New Issue