@@ -650,7 +650,7 @@ def test__handle_message_event_with_Falsey_log(self, mocker,
650650 model .found_newest = True
651651 mocker .patch ('zulipterminal.model.Model._update_topic_index' )
652652 index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
653- return_value = {} )
653+ return_value = initial_index )
654654 model .msg_list = mocker .Mock (log = [])
655655 create_msg_box_list = mocker .patch ('zulipterminal.model.'
656656 'create_msg_box_list' ,
@@ -671,7 +671,7 @@ def test__handle_message_event_with_valid_log(self, mocker,
671671 model .found_newest = True
672672 mocker .patch ('zulipterminal.model.Model._update_topic_index' )
673673 index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
674- return_value = {} )
674+ return_value = initial_index )
675675 model .msg_list = mocker .Mock (log = [mocker .Mock ()])
676676 create_msg_box_list = mocker .patch ('zulipterminal.model.'
677677 'create_msg_box_list' ,
@@ -689,12 +689,37 @@ def test__handle_message_event_with_valid_log(self, mocker,
689689 assert_called_once_with (model , [message_fixture ['id' ]],
690690 last_message = expected_last_msg ))
691691
692+ @pytest .mark .parameter ('unread_msgs' , [
693+ ({'type' : 'stream' , 'stream_id' : 5140 ,
694+ 'subject' : 'Test' , 'display_recipient' : 'PTEST' }),
695+ ({'type' : 'private' , 'sender_id' : '5140' }),
696+ ({'type' : 'private' , 'display_recipient' :
697+ [{
698+ 'id' : 5179 ,
699+ 'is_mirror_dummy' : False ,
700+ 'full_name' : 'Boo Boo' ,
701+ 'short_name' : 'boo' ,
702+ 703+ }, {
704+ 'short_name' : 'foo' ,
705+ 'id' : 5140 ,
706+ 'is_mirror_dummy' : False ,
707+ 'full_name' : 'Foo Foo' ,
708+ 709+ }, {
710+ 'short_name' : 'bar' ,
711+ 'id' : 5180 ,
712+ 'is_mirror_dummy' : False ,
713+ 'full_name' : 'Bar Bar' ,
714+ 715+ }]}),
716+ ])
692717 def test__handle_message_event_with_flags (self , mocker ,
693718 model , message_fixture ):
694719 model .found_newest = True
695720 mocker .patch ('zulipterminal.model.Model._update_topic_index' )
696721 index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
697- return_value = {} )
722+ return_value = initial_index )
698723 model .msg_list = mocker .Mock ()
699724 create_msg_box_list = mocker .patch ('zulipterminal.model.'
700725 'create_msg_box_list' ,
@@ -720,8 +745,9 @@ def test__handle_message_event_with_flags(self, mocker,
720745
721746 @pytest .mark .parametrize ('response, narrow, recipients, log' , [
722747 ({'type' : 'stream' , 'stream_id' : 1 , 'subject' : 'FOO' ,
723- 'id' : 1 }, [], frozenset (), ['msg_w' ]),
724- ({'type' : 'private' , 'id' : 1 },
748+ 'id' : 1 , 'display_recipient' : 'a' }, [], frozenset (), ['msg_w' ]),
749+ ({'type' : 'private' , 'id' : 1 , 'sender_id' : 1 ,
750+ 'display_recipient' : []},
725751 [['is' , 'private' ]], frozenset (), ['msg_w' ]),
726752 ({'type' : 'stream' , 'id' : 1 , 'stream_id' : 1 , 'subject' : 'FOO' ,
727753 'display_recipient' : 'a' },
@@ -734,14 +760,15 @@ def test__handle_message_event_with_flags(self, mocker,
734760 'display_recipient' : 'a' },
735761 [['stream' , 'c' ], ['topic' , 'b' ]],
736762 frozenset (), []),
737- ({'type' : 'private' , 'id' : 1 ,
763+ ({'type' : 'private' , 'id' : 1 , 'sender_id' : 5827 ,
738764 'display_recipient' : [{'id' : 5827 }, {'id' : 5 }]},
739765 [['pm_with' , '[email protected] ' ]], 740766 frozenset ({5827 , 5 }), ['msg_w' ]),
741- ({'type' : 'private' , 'id' : 1 },
767+ ({'type' : 'private' , 'id' : 1 , 'sender_id' : 5827 ,
768+ 'display_recipient' : []},
742769 [['is' , 'search' ]],
743770 frozenset (), []),
744- ({'type' : 'private' , 'id' : 1 ,
771+ ({'type' : 'private' , 'id' : 1 , 'sender_id' : 5827 ,
745772 'display_recipient' : [{'id' : 5827 }, {'id' : 3212 }]},
746773 [['pm_with' , '[email protected] ' ]], 747774 frozenset ({5827 , 5 }), []),
@@ -759,7 +786,7 @@ def test__handle_message_event(self, mocker, user_profile, response,
759786 model .found_newest = True
760787 mocker .patch ('zulipterminal.model.Model._update_topic_index' )
761788 index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
762- return_value = {} )
789+ return_value = initial_index )
763790 create_msg_box_list = mocker .patch ('zulipterminal.model.'
764791 'create_msg_box_list' ,
765792 return_value = ["msg_w" ])
0 commit comments