@@ -650,7 +650,7 @@ def test_append_message_with_Falsey_log(self, mocker, model,
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 ()
655655 create_msg_box_list = mocker .patch ('zulipterminal.model.'
656656 'create_msg_box_list' ,
@@ -672,7 +672,7 @@ def test_append_message_with_valid_log(self, mocker, model,
672672 model .found_newest = True
673673 mocker .patch ('zulipterminal.model.Model.update_topic_index' )
674674 index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
675- return_value = {} )
675+ return_value = initial_index )
676676 model .msg_list = mocker .Mock ()
677677 create_msg_box_list = mocker .patch ('zulipterminal.model.'
678678 'create_msg_box_list' ,
@@ -691,11 +691,36 @@ def test_append_message_with_valid_log(self, mocker, model,
691691 assert_called_once_with (model , [message_fixture ['id' ]],
692692 last_message = expected_last_msg ))
693693
694+ @pytest .mark .parameter ('unread_msgs' , [
695+ ({'type' : 'stream' , 'stream_id' : 5140 ,
696+ 'subject' : 'Test' , 'display_recipient' : 'PTEST' }),
697+ ({'type' : 'private' , 'sender_id' : '5140' }),
698+ ({'type' : 'private' , 'display_recipient' :
699+ [{
700+ 'id' : 5179 ,
701+ 'is_mirror_dummy' : False ,
702+ 'full_name' : 'Boo Boo' ,
703+ 'short_name' : 'boo' ,
704+ 705+ }, {
706+ 'short_name' : 'foo' ,
707+ 'id' : 5140 ,
708+ 'is_mirror_dummy' : False ,
709+ 'full_name' : 'Foo Foo' ,
710+ 711+ }, {
712+ 'short_name' : 'bar' ,
713+ 'id' : 5180 ,
714+ 'is_mirror_dummy' : False ,
715+ 'full_name' : 'Bar Bar' ,
716+ 717+ }]}),
718+ ])
694719 def test_append_message_event_flags (self , mocker , model , message_fixture ):
695720 model .found_newest = True
696721 mocker .patch ('zulipterminal.model.Model.update_topic_index' )
697722 index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
698- return_value = {} )
723+ return_value = initial_index )
699724 model .msg_list = mocker .Mock ()
700725 create_msg_box_list = mocker .patch ('zulipterminal.model.'
701726 'create_msg_box_list' ,
@@ -721,8 +746,9 @@ def test_append_message_event_flags(self, mocker, model, message_fixture):
721746
722747 @pytest .mark .parametrize ('response, narrow, recipients, log' , [
723748 ({'type' : 'stream' , 'stream_id' : 1 , 'subject' : 'FOO' ,
724- 'id' : 1 }, [], frozenset (), ['msg_w' ]),
725- ({'type' : 'private' , 'id' : 1 },
749+ 'id' : 1 , 'display_recipient' : 'a' }, [], frozenset (), ['msg_w' ]),
750+ ({'type' : 'private' , 'id' : 1 , 'sender_id' : 1 ,
751+ 'display_recipient' : []},
726752 [['is' , 'private' ]], frozenset (), ['msg_w' ]),
727753 ({'type' : 'stream' , 'id' : 1 , 'stream_id' : 1 , 'subject' : 'FOO' ,
728754 'display_recipient' : 'a' },
@@ -735,14 +761,15 @@ def test_append_message_event_flags(self, mocker, model, message_fixture):
735761 'display_recipient' : 'a' },
736762 [['stream' , 'c' ], ['topic' , 'b' ]],
737763 frozenset (), []),
738- ({'type' : 'private' , 'id' : 1 ,
764+ ({'type' : 'private' , 'id' : 1 , 'sender_id' : 5827 ,
739765 'display_recipient' : [{'id' : 5827 }, {'id' : 5 }]},
740766 [['pm_with' , '[email protected] ' ]], 741767 frozenset ({5827 , 5 }), ['msg_w' ]),
742- ({'type' : 'private' , 'id' : 1 },
768+ ({'type' : 'private' , 'id' : 1 , 'sender_id' : 5827 ,
769+ 'display_recipient' : []},
743770 [['is' , 'search' ]],
744771 frozenset (), []),
745- ({'type' : 'private' , 'id' : 1 ,
772+ ({'type' : 'private' , 'id' : 1 , 'sender_id' : 5827 ,
746773 'display_recipient' : [{'id' : 5827 }, {'id' : 3212 }]},
747774 [['pm_with' , '[email protected] ' ]], 748775 frozenset ({5827 , 5 }), []),
@@ -756,7 +783,7 @@ def test_append_message(self, mocker, user_profile, response,
756783 model .found_newest = True
757784 mocker .patch ('zulipterminal.model.Model.update_topic_index' )
758785 index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
759- return_value = {} )
786+ return_value = initial_index )
760787 create_msg_box_list = mocker .patch ('zulipterminal.model.'
761788 'create_msg_box_list' ,
762789 return_value = ["msg_w" ])
0 commit comments