streams: Set creator for some initial streams in populate_db.

This is a follow-up to #29425. It assigns creator to three streams
that are used in tests and another two that aren't. For tests,
we assign a guest, an admin and an owner as creator.
This commit is contained in:
tnmkr
2024-05-14 09:18:41 +05:30
committed by Tim Abbott
parent e264b12066
commit 51635c81fc
3 changed files with 21 additions and 5 deletions

View File

@@ -222,6 +222,7 @@ def bulk_create_streams(realm: Realm, stream_dict: Dict[str, Dict[str, Any]]) ->
is_web_public=options.get("is_web_public", False),
is_in_zephyr_realm=realm.is_zephyr_mirror_realm,
can_remove_subscribers_group=administrators_user_group,
creator=options.get("creator", None),
),
)
# Sort streams by name before creating them so that we can have a

View File

@@ -4470,7 +4470,20 @@ class SubscriptionAPITest(ZulipTestCase):
self.assertEqual(stream["creator_id"], iago.id)
continue
# Streams that aren't created using the api should have no creator
# We assign creator to some streams in populate_db.
if stream["name"] == "Venice":
self.assertEqual(stream["creator_id"], self.example_user("polonius").id)
continue
if stream["name"] == "Scotland":
self.assertEqual(stream["creator_id"], self.example_user("iago").id)
continue
if stream["name"] == "core team":
self.assertEqual(stream["creator_id"], self.example_user("desdemona").id)
continue
# Other streams that weren't created using the api should have no creator.
self.assertIsNone(stream["creator_id"])
def test_private_stream_policies(self) -> None:

View File

@@ -637,12 +637,13 @@ class Command(BaseCommand):
]
stream_dict: Dict[str, Dict[str, Any]] = {
"Denmark": {"description": "A Scandinavian country"},
"Scotland": {"description": "Located in the United Kingdom"},
"Venice": {"description": "A northeastern Italian city"},
"Scotland": {"description": "Located in the United Kingdom", "creator": iago},
"Venice": {"description": "A northeastern Italian city", "creator": polonius},
"Rome": {"description": "Yet another Italian city", "is_web_public": True},
"core team": {
"description": "A private channel for core team members",
"invite_only": True,
"creator": desdemona,
},
}
@@ -1001,13 +1002,14 @@ class Command(BaseCommand):
"devel": {"description": "For developing"},
# ビデオゲーム - VideoGames (japanese)
"ビデオゲーム": {
"description": f"Share your favorite video games! {raw_emojis[2]}"
"description": f"Share your favorite video games! {raw_emojis[2]}",
"creator": shiva,
},
"announce": {
"description": "For announcements",
"stream_post_policy": Stream.STREAM_POST_POLICY_ADMINS,
},
"design": {"description": "For design"},
"design": {"description": "For design", "creator": hamlet},
"support": {"description": "For support"},
"social": {"description": "For socializing"},
"test": {"description": "For testing `code`"},