mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 02:48:00 +00:00
test helpers: Simplify check_user_subscribed_only_to_streams.
b4fedaa765 introduced
this helper, and I assume that the weird loop over
zip made sense at the time.
The assertEqual approach on the whole
set gives nice messages in modern Python.
This commit is contained in:
@@ -1511,16 +1511,10 @@ Output:
|
|||||||
|
|
||||||
return "".join(sorted(f" * {stream['name']}\n" for stream in subscribed_streams))
|
return "".join(sorted(f" * {stream['name']}\n" for stream in subscribed_streams))
|
||||||
|
|
||||||
def check_user_subscribed_only_to_streams(
|
def check_user_subscribed_only_to_streams(self, user_name: str, streams: set[Stream]) -> None:
|
||||||
self, user_name: str, stream_set: set[Stream]
|
stream_names = {stream.name for stream in streams}
|
||||||
) -> None:
|
|
||||||
streams = sorted(stream_set, key=lambda x: x.name)
|
|
||||||
subscribed_streams = gather_subscriptions(self.nonreg_user(user_name))[0]
|
subscribed_streams = gather_subscriptions(self.nonreg_user(user_name))[0]
|
||||||
|
self.assertEqual(stream_names, {stream["name"] for stream in subscribed_streams})
|
||||||
self.assert_length(subscribed_streams, len(streams))
|
|
||||||
|
|
||||||
for x, y in zip(subscribed_streams, streams, strict=False):
|
|
||||||
self.assertEqual(x["name"], y.name)
|
|
||||||
|
|
||||||
def resolve_topic_containing_message(
|
def resolve_topic_containing_message(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user