Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
test_message_dict: Add test for checking "subject" field value.
Sahil Batra5a45779634c8
diff --git a/zerver/tests/test_message_dict.py b/zerver/tests/test_message_dict.pyindex 9482d4a7060..3db9754fe0a 100644--- a/zerver/tests/test_message_dict.py+++ b/zerver/tests/test_message_dict.py@@ -11,7 +11,7 @@ from zerver.lib.message_cache import MessageDict, sew_messages_and_reactionsfrom zerver.lib.per_request_cache import flush_per_request_cachesfrom zerver.lib.test_classes import ZulipTestCasefrom zerver.lib.test_helpers import make_client-from zerver.lib.topic import TOPIC_LINKS+from zerver.lib.topic import TOPIC_LINKS, TOPIC_NAMEfrom zerver.lib.types import DisplayRecipientT, UserDisplayRecipientfrom zerver.models import Message, Reaction, Realm, RealmFilter, Recipient, Stream, UserProfilefrom zerver.models.realms import MessageEditHistoryVisibilityPolicyEnum, get_realm@@ -664,6 +664,43 @@ class TestMessageForIdsDisplayRecipientFetching(ZulipTestCase):)self._verify_display_recipient(messages[5]["display_recipient"], [cordelia, othello])+ def test_topic_field(self) -> None:+ hamlet = self.example_user("hamlet")+ cordelia = self.example_user("cordelia")+ othello = self.example_user("othello")+ iago = self.example_user("iago")++ self.subscribe(cordelia, "Denmark")+ self.subscribe(hamlet, "Scotland")++ message_ids = [+ self.send_group_direct_message(hamlet, [cordelia, othello], "test"),+ self.send_stream_message(cordelia, "Verona", content="test"),+ self.send_personal_message(hamlet, cordelia, "test"),+ self.send_stream_message(cordelia, "Denmark", content="test"),+ self.send_group_direct_message(cordelia, [hamlet, othello, iago], "test"),+ self.send_personal_message(cordelia, othello, "test"),+ ]++ messages = messages_for_ids(+ message_ids=message_ids,+ user_message_flags={message_id: ["read"] for message_id in message_ids},+ search_fields={},+ apply_markdown=True,+ client_gravatar=True,+ allow_empty_topic_name=True,+ message_edit_history_visibility_policy=MessageEditHistoryVisibilityPolicyEnum.none.value,+ user_profile=cordelia,+ realm=cordelia.realm,+ )+ self.assertEqual(messages[0][TOPIC_NAME], "")+ self.assertEqual(messages[2][TOPIC_NAME], "")+ self.assertEqual(messages[4][TOPIC_NAME], "")+ self.assertEqual(messages[5][TOPIC_NAME], "")++ self.assertEqual(messages[1][TOPIC_NAME], "test")+ self.assertEqual(messages[3][TOPIC_NAME], "test")+class SewMessageAndReactionTest(ZulipTestCase):def test_sew_messages_and_reaction(self) -> None: