From 947b2b55fe31790a363a2e5612bf2fe076bedfc4 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Wed, 16 Feb 2022 22:07:00 +0530 Subject: [PATCH] populate_db: Set owners for bots in development and test database. Since we do not allow to remove owners from bots, it is better to keep owners for the bots in development environment as well. We need to change puppeteer tests here because now desdemona already has bots in dev server and thus "Active bots" section is opened by default in the settings instead of "Add a new bot" section. --- frontend_tests/puppeteer_tests/settings.ts | 1 + zilencer/management/commands/populate_db.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend_tests/puppeteer_tests/settings.ts b/frontend_tests/puppeteer_tests/settings.ts index 1a1c049a69..1f08edd431 100644 --- a/frontend_tests/puppeteer_tests/settings.ts +++ b/frontend_tests/puppeteer_tests/settings.ts @@ -228,6 +228,7 @@ async function test_invalid_edit_bot_form(page: Page): Promise { async function test_your_bots_section(page: Page): Promise { await page.click('[data-section="your-bots"]'); + await page.click(".add-a-new-bot-tab"); await test_webhook_bot_creation(page); await test_normal_bot_creation(page); await test_botserverrc(page); diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.py index fa095f8660..e7f187aa29 100644 --- a/zilencer/management/commands/populate_db.py +++ b/zilencer/management/commands/populate_db.py @@ -507,7 +507,9 @@ class Command(BaseCommand): for i in range(options["extra_bots"]): zulip_realm_bots.append((f"Extra Bot {i}", f"extrabot{i}@zulip.com")) - create_users(zulip_realm, zulip_realm_bots, bot_type=UserProfile.DEFAULT_BOT) + create_users( + zulip_realm, zulip_realm_bots, bot_type=UserProfile.DEFAULT_BOT, bot_owner=desdemona + ) zoe = get_user_by_delivery_email("zoe@zulip.com", zulip_realm) zulip_webhook_bots = [ @@ -911,7 +913,10 @@ class Command(BaseCommand): ("Zulip Nagios Bot", "nagios-bot@zulip.com"), ] create_users( - zulip_realm, internal_zulip_users_nosubs, bot_type=UserProfile.DEFAULT_BOT + zulip_realm, + internal_zulip_users_nosubs, + bot_type=UserProfile.DEFAULT_BOT, + bot_owner=desdemona, ) mark_all_messages_as_read()