@@ -650,7 +650,7 @@ def test__handle_message_event_with_Falsey_log(self, mocker,
650
650
model .found_newest = True
651
651
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
652
652
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
653
- return_value = {} )
653
+ return_value = initial_index )
654
654
model .msg_list = mocker .Mock (log = [])
655
655
create_msg_box_list = mocker .patch ('zulipterminal.model.'
656
656
'create_msg_box_list' ,
@@ -671,7 +671,7 @@ def test__handle_message_event_with_valid_log(self, mocker,
671
671
model .found_newest = True
672
672
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
673
673
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
674
- return_value = {} )
674
+ return_value = initial_index )
675
675
model .msg_list = mocker .Mock (log = [mocker .Mock ()])
676
676
create_msg_box_list = mocker .patch ('zulipterminal.model.'
677
677
'create_msg_box_list' ,
@@ -689,12 +689,37 @@ def test__handle_message_event_with_valid_log(self, mocker,
689
689
assert_called_once_with (model , [message_fixture ['id' ]],
690
690
last_message = expected_last_msg ))
691
691
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
+ 'email' : 'boo@zulip.com' ,
703
+ }, {
704
+ 'short_name' : 'foo' ,
705
+ 'id' : 5140 ,
706
+ 'is_mirror_dummy' : False ,
707
+ 'full_name' : 'Foo Foo' ,
708
+ 'email' : 'foo@zulip.com' ,
709
+ }, {
710
+ 'short_name' : 'bar' ,
711
+ 'id' : 5180 ,
712
+ 'is_mirror_dummy' : False ,
713
+ 'full_name' : 'Bar Bar' ,
714
+ 'email' : 'bar@zulip.com' ,
715
+ }]}),
716
+ ])
692
717
def test__handle_message_event_with_flags (self , mocker ,
693
718
model , message_fixture ):
694
719
model .found_newest = True
695
720
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
696
721
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
697
- return_value = {} )
722
+ return_value = initial_index )
698
723
model .msg_list = mocker .Mock ()
699
724
create_msg_box_list = mocker .patch ('zulipterminal.model.'
700
725
'create_msg_box_list' ,
@@ -720,8 +745,9 @@ def test__handle_message_event_with_flags(self, mocker,
720
745
721
746
@pytest .mark .parametrize ('response, narrow, recipients, log' , [
722
747
({'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' : []},
725
751
[['is' , 'private' ]], frozenset (), ['msg_w' ]),
726
752
({'type' : 'stream' , 'id' : 1 , 'stream_id' : 1 , 'subject' : 'FOO' ,
727
753
'display_recipient' : 'a' },
@@ -734,14 +760,15 @@ def test__handle_message_event_with_flags(self, mocker,
734
760
'display_recipient' : 'a' },
735
761
[['stream' , 'c' ], ['topic' , 'b' ]],
736
762
frozenset (), []),
737
- ({'type' : 'private' , 'id' : 1 ,
763
+ ({'type' : 'private' , 'id' : 1 , 'sender_id' : 5827 ,
738
764
'display_recipient' : [{'id' : 5827 }, {'id' : 5 }]},
739
765
[['pm_with' , 'notification-bot@zulip.com' ]],
740
766
frozenset ({5827 , 5 }), ['msg_w' ]),
741
- ({'type' : 'private' , 'id' : 1 },
767
+ ({'type' : 'private' , 'id' : 1 , 'sender_id' : 5827 ,
768
+ 'display_recipient' : []},
742
769
[['is' , 'search' ]],
743
770
frozenset (), []),
744
- ({'type' : 'private' , 'id' : 1 ,
771
+ ({'type' : 'private' , 'id' : 1 , 'sender_id' : 5827 ,
745
772
'display_recipient' : [{'id' : 5827 }, {'id' : 3212 }]},
746
773
[['pm_with' , 'notification-bot@zulip.com' ]],
747
774
frozenset ({5827 , 5 }), []),
@@ -759,7 +786,7 @@ def test__handle_message_event(self, mocker, user_profile, response,
759
786
model .found_newest = True
760
787
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
761
788
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
762
- return_value = {} )
789
+ return_value = initial_index )
763
790
create_msg_box_list = mocker .patch ('zulipterminal.model.'
764
791
'create_msg_box_list' ,
765
792
return_value = ["msg_w" ])
0 commit comments