Skip to content

Commit a24f7c9

Browse files
committed
model: Add get_all_subscription_ids accessor method.
This commit adds the subscription ids accessor method "get_all_stream_ids". This helps in preparation for including subscription color accessor method added in the next commit. Tests added.
1 parent 5c83fe9 commit a24f7c9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/model/test_model.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,6 +2088,15 @@ def test_is_stream_invite_only(
20882088
assert model.is_stream_invite_only(stream_id) == expected_value
20892089
model._get_stream_from_id.assert_called_once()
20902090

2091+
def test_get_all_subscription_ids(
2092+
self,
2093+
model,
2094+
stream_dict,
2095+
expected_value=[1000, 99, 999, 1, 2],
2096+
):
2097+
model.stream_dict = stream_dict
2098+
assert model.get_all_subscription_ids() == expected_value
2099+
20912100
@pytest.mark.parametrize("muted", powerset([99, 1000]))
20922101
@pytest.mark.parametrize("visual_notification_enabled", powerset([99, 1000]))
20932102
def test__subscribe_to_streams(

zulipterminal/model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,9 @@ def get_all_stream_ids(self) -> List[int]:
11921192
id_list.extend(stream_id for stream_id in self._never_subscribed_streams)
11931193
return id_list
11941194

1195+
def get_all_subscription_ids(self) -> List[int]:
1196+
return list(self.stream_dict)
1197+
11951198
def get_stream_name(self, stream_id: int) -> str:
11961199
return self._get_stream_from_id(stream_id)["name"]
11971200

0 commit comments

Comments
 (0)