@@ -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 .found_newest is False
47
+ assert isinstance ( model .found_newest , 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 .found_newest is True
470
+ assert model .found_newest [ 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 ,
@@ -502,9 +502,10 @@ def test_get_message_false_first_anchor(
502
502
assert model .index ['pointer' ][repr (model .narrow )] == 0
503
503
504
504
# TEST `query_range` < no of messages received
505
- model .found_newest = False # RESET model.found_newest value
505
+ # RESET model.found_newest value
506
+ model .found_newest [repr (model .narrow )] = False
506
507
model .get_messages (num_after = 0 , num_before = 0 , anchor = 0 )
507
- assert model .found_newest is False
508
+ assert model .found_newest [ repr ( model . narrow )] is False
508
509
509
510
# FIXME This only tests the case where the get_messages is in __init__
510
511
def test_fail_get_messages (self , mocker , error_response ,
@@ -652,7 +653,7 @@ def test__stream_info_from_subscriptions(self, initial_data, streams,
652
653
653
654
def test__handle_message_event_with_Falsey_log (self , mocker ,
654
655
model , message_fixture ):
655
- model .found_newest = True
656
+ model .found_newest [ repr ([])] = True
656
657
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
657
658
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
658
659
return_value = {})
@@ -673,7 +674,7 @@ def test__handle_message_event_with_Falsey_log(self, mocker,
673
674
674
675
def test__handle_message_event_with_valid_log (self , mocker ,
675
676
model , message_fixture ):
676
- model .found_newest = True
677
+ model .found_newest [ repr ([])] = True
677
678
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
678
679
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
679
680
return_value = {})
@@ -696,7 +697,7 @@ def test__handle_message_event_with_valid_log(self, mocker,
696
697
697
698
def test__handle_message_event_with_flags (self , mocker ,
698
699
model , message_fixture ):
699
- model .found_newest = True
700
+ model .found_newest [ repr ([])] = True
700
701
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
701
702
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
702
703
return_value = {})
@@ -761,7 +762,7 @@ def test__handle_message_event_with_flags(self, mocker,
761
762
'mentioned_msg_in_mentioned_msg_narrow' ])
762
763
def test__handle_message_event (self , mocker , user_profile , response ,
763
764
narrow , recipients , model , log ):
764
- model .found_newest = True
765
+ model .found_newest [ repr ( narrow )] = True
765
766
mocker .patch ('zulipterminal.model.Model._update_topic_index' )
766
767
index_msg = mocker .patch ('zulipterminal.model.index_messages' ,
767
768
return_value = {})
@@ -782,7 +783,7 @@ def test__handle_message_event(self, mocker, user_profile, response,
782
783
assert model .msg_list .log == log
783
784
set_count .assert_called_once_with ([response ['id' ]], self .controller , 1 )
784
785
785
- model .found_newest = False
786
+ model .found_newest [ repr ( narrow )] = False
786
787
model .notify_user .assert_called_once_with (response )
787
788
model ._handle_message_event (event )
788
789
# LOG REMAINS THE SAME IF UPDATE IS FALSE
0 commit comments