@@ -44,7 +44,7 @@ def test_init(self, model, initial_data, user_profile):
44
44
assert model .msg_view is None
45
45
assert model .msg_list is None
46
46
assert model .narrow == []
47
- assert model ._have_last_message is False
47
+ assert isinstance ( model ._have_last_message , dict )
48
48
assert model .stream_id == - 1
49
49
assert model .stream_dict == {}
50
50
assert model .recipients == frozenset ()
@@ -467,7 +467,7 @@ def test_success_get_messages(self, mocker, messages_successful_response,
467
467
anchor = messages_successful_response ['anchor' ]
468
468
if anchor < 10000000000000000 :
469
469
assert model .index ['pointer' ][repr (model .narrow )] == anchor
470
- assert model ._have_last_message is True
470
+ assert model ._have_last_message [ repr ( model . narrow )] is True
471
471
472
472
def test_get_message_false_first_anchor (
473
473
self , mocker , messages_successful_response , index_all_messages ,
@@ -503,9 +503,9 @@ def test_get_message_false_first_anchor(
503
503
504
504
# TEST `query_range` < no of messages received
505
505
# RESET model._have_last_message value
506
- model ._have_last_message = False
506
+ model ._have_last_message [ repr ( model . narrow )] = False
507
507
model .get_messages (num_after = 0 , num_before = 0 , anchor = 0 )
508
- assert model ._have_last_message is False
508
+ assert model ._have_last_message [ repr ( model . narrow )] is False
509
509
510
510
# FIXME This only tests the case where the get_messages is in __init__
511
511
def test_fail_get_messages (self , mocker , error_response ,
@@ -653,7 +653,7 @@ def test__stream_info_from_subscriptions(self, initial_data, streams,
653
653
654
654
def test__handle_message_event_with_Falsey_log (self , mocker ,
655
655
model , message_fixture ):
656
- model ._have_last_message = True
656
+ model ._have_last_message [ repr ([])] = True
657
657
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
658
658
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
659
659
return_value = {})
@@ -674,7 +674,7 @@ def test__handle_message_event_with_Falsey_log(self, mocker,
674
674
675
675
def test__handle_message_event_with_valid_log (self , mocker ,
676
676
model , message_fixture ):
677
- model ._have_last_message = True
677
+ model ._have_last_message [ repr ([])] = True
678
678
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
679
679
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
680
680
return_value = {})
@@ -697,7 +697,7 @@ def test__handle_message_event_with_valid_log(self, mocker,
697
697
698
698
def test__handle_message_event_with_flags (self , mocker ,
699
699
model , message_fixture ):
700
- model ._have_last_message = True
700
+ model ._have_last_message [ repr ([])] = True
701
701
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
702
702
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
703
703
return_value = {})
@@ -762,7 +762,7 @@ def test__handle_message_event_with_flags(self, mocker,
762
762
'mentioned_msg_in_mentioned_msg_narrow' ])
763
763
def test__handle_message_event (self , mocker , user_profile , response ,
764
764
narrow , recipients , model , log ):
765
- model ._have_last_message = True
765
+ model ._have_last_message [ repr ( narrow )] = True
766
766
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
767
767
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
768
768
return_value = {})
@@ -783,7 +783,7 @@ def test__handle_message_event(self, mocker, user_profile, response,
783
783
assert model .msg_list .log == log
784
784
set_count .assert_called_once_with ([response ['id' ]], self .controller , 1 )
785
785
786
- model ._have_last_message = False
786
+ model ._have_last_message [ repr ( narrow )] = False
787
787
model .notify_user .assert_called_once_with (response )
788
788
model ._handle_message_event (event )
789
789
# LOG REMAINS THE SAME IF UPDATE IS FALSE
0 commit comments