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