mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
messages: Add unit test for get_raw_unread_data.
Add test with 2 messages to the same group PM thread.
This commit is contained in:
committed by
Tim Abbott
parent
3b4ff4f75c
commit
1579f8cb4b
@@ -34,6 +34,7 @@ from zerver.lib.message import (
|
|||||||
get_first_visible_message_id,
|
get_first_visible_message_id,
|
||||||
update_first_visible_message_id,
|
update_first_visible_message_id,
|
||||||
maybe_update_first_visible_message_id,
|
maybe_update_first_visible_message_id,
|
||||||
|
get_raw_unread_data,
|
||||||
)
|
)
|
||||||
|
|
||||||
from zerver.lib.test_helpers import (
|
from zerver.lib.test_helpers import (
|
||||||
@@ -754,6 +755,31 @@ class StreamMessagesTest(ZulipTestCase):
|
|||||||
self.assert_stream_message(non_ascii_stream_name, topic_name=u"hümbüǵ",
|
self.assert_stream_message(non_ascii_stream_name, topic_name=u"hümbüǵ",
|
||||||
content=u"hümbüǵ")
|
content=u"hümbüǵ")
|
||||||
|
|
||||||
|
def test_get_raw_unread_data_for_huddle_messages(self) -> None:
|
||||||
|
users = [
|
||||||
|
self.example_user('hamlet'),
|
||||||
|
self.example_user('cordelia'),
|
||||||
|
self.example_user('iago'),
|
||||||
|
self.example_user('prospero'),
|
||||||
|
self.example_user('othello'),
|
||||||
|
]
|
||||||
|
|
||||||
|
message1_id = self.send_huddle_message(users[0].email,
|
||||||
|
[user.email for user in users],
|
||||||
|
"test content 1")
|
||||||
|
message2_id = self.send_huddle_message(users[0].email,
|
||||||
|
[user.email for user in users],
|
||||||
|
"test content 2")
|
||||||
|
|
||||||
|
msg_data = get_raw_unread_data(users[1])
|
||||||
|
|
||||||
|
# both the messages are present in msg_data
|
||||||
|
self.assertIn(message1_id, msg_data["huddle_dict"].keys())
|
||||||
|
self.assertIn(message2_id, msg_data["huddle_dict"].keys())
|
||||||
|
|
||||||
|
# only these two messages are present in msg_data
|
||||||
|
self.assertEqual(len(msg_data["huddle_dict"].keys()), 2)
|
||||||
|
|
||||||
class MessageDictTest(ZulipTestCase):
|
class MessageDictTest(ZulipTestCase):
|
||||||
@slow('builds lots of messages')
|
@slow('builds lots of messages')
|
||||||
def test_bulk_message_fetching(self) -> None:
|
def test_bulk_message_fetching(self) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user