server_initialization: Set internal bots owners to themselves.

This commit is contained in:
Mateusz Mandera
2020-01-28 14:41:08 +01:00
committed by Tim Abbott
parent 9c20611a65
commit 39b012a276
2 changed files with 6 additions and 1 deletions

View File

@@ -17,6 +17,11 @@ def create_internal_realm() -> None:
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)
# Set the owners for these bots to the bots themselves
bots = UserProfile.objects.filter(email__in=[bot_info[1] for bot_info in internal_realm_bots])
for bot in bots:
bot.bot_owner = bot
bot.save()
# Initialize the email gateway bot as an API Super User
email_gateway_bot = get_system_bot(settings.EMAIL_GATEWAY_BOT)

View File

@@ -3183,7 +3183,7 @@ class SubscriptionAPITest(ZulipTestCase):
dict(principals=ujson.dumps([user1.email, user2.email])),
invite_only=True,
)
self.assert_length(queries, 38)
self.assert_length(queries, 40)
# Test creating a public stream with announce when realm has a notification stream.
notifications_stream = get_stream(self.streams[0], self.test_realm)