diff --git a/zerver/lib/server_initialization.py b/zerver/lib/server_initialization.py index d42ce10db8..2f3a42dd64 100644 --- a/zerver/lib/server_initialization.py +++ b/zerver/lib/server_initialization.py @@ -2,13 +2,18 @@ from django.conf import settings from zerver.lib.actions import do_change_is_admin from zerver.lib.bulk_create import bulk_create_users -from zerver.models import Realm, UserProfile, email_to_username, get_system_bot +from zerver.models import Realm, UserProfile, email_to_username, get_client, \ + get_system_bot from typing import Iterable, Optional, Set, Tuple def create_internal_realm() -> None: internal_realm = Realm.objects.create(string_id=settings.SYSTEM_BOT_REALM) + # Create the "website" and "API" clients: + get_client("website") + get_client("API") + internal_realm_bots = [(bot['name'], bot['email_template'] % (settings.INTERNAL_BOT_DOMAIN,)) for bot in settings.INTERNAL_BOTS] create_users(internal_realm, internal_realm_bots, bot_type=UserProfile.DEFAULT_BOT) diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.py index 54703e3ecc..2220e1238a 100644 --- a/zilencer/management/commands/populate_db.py +++ b/zilencer/management/commands/populate_db.py @@ -465,12 +465,6 @@ class Command(BaseCommand): generate_and_send_messages(job) if options["delete"]: - # Create the "website" and "API" clients; if we don't, the - # default values in zerver/decorators.py will not work - # with the Django test suite. - get_client("website") - get_client("API") - if options["test_suite"]: # Create test users; the MIT ones are needed to test # the Zephyr mirroring codepaths.