Skip to content

Commit 6e229d2

Browse files
committed
Add tests
1 parent 8fef21a commit 6e229d2

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

tests/conftest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def empty_index():
481481
pm_template['id']: pm_template,
482482
group_pm_template['id']: group_pm_template,
483483
}),
484-
'unread_msgs': set()
484+
'unread_msg_ids': set()
485485
})
486486

487487

@@ -526,6 +526,11 @@ def index_user(empty_index):
526526
return dict(empty_index, **diff)
527527

528528

529+
@pytest.fixture
530+
def index_unread_message_ids():
531+
return {1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 101, 102}
532+
533+
529534
@pytest.fixture
530535
def index_user_multiple(empty_index):
531536
"""

tests/helper/test_helper.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,17 @@ def test_powerset(iterable, map_func, expected_powerset):
179179
)
180180
def test_classify_unread_counts(mocker, initial_data, stream_dict,
181181
classified_unread_counts, muted_topics,
182-
muted_streams, vary_in_unreads):
182+
muted_streams, vary_in_unreads, initial_index,
183+
index_unread_message_ids):
183184
model = mocker.Mock()
184185
model.stream_dict = stream_dict
185186
model.initial_data = initial_data
186187
model.muted_topics = muted_topics
187188
model.muted_streams = muted_streams
188-
assert classify_unread_counts(model) == dict(classified_unread_counts,
189-
**vary_in_unreads)
189+
model.index = initial_index
190+
assert classify_unread_counts(model) == dict(
191+
classified_unread_counts, **vary_in_unreads)
192+
assert model.index['unread_msg_ids'] == index_unread_message_ids
190193

191194

192195
@pytest.mark.parametrize('color', [

0 commit comments

Comments
 (0)