From 7af5ceb1c583e896703b81839b36b3917172c40b Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Tue, 16 May 2023 21:08:33 +0200 Subject: [PATCH] scheduled-messages: Add direct scheduled message to populate_db. Prep commit for splitting create/edit endpoint for scheduled messages. Because of `test-api` runs the tests in alphabetical order based on the `operationId`, we need two scheduled messages in the test database. The first for the curl example delete (delete-scheduled-message) and the second for the curl example update (update-scheduled-message). --- zerver/tests/test_home.py | 2 +- zilencer/management/commands/populate_db.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py index 33a426dbc0..b03d6ab80a 100644 --- a/zerver/tests/test_home.py +++ b/zerver/tests/test_home.py @@ -439,7 +439,7 @@ class HomeTest(ZulipTestCase): # Verify number of queries for Realm admin isn't much higher than for normal users. self.login("iago") flush_per_request_caches() - with self.assert_database_query_count(48): + with self.assert_database_query_count(50): with patch("zerver.lib.cache.cache_set") as cache_mock: result = self._get_home_page() self.check_rendered_logged_in_app(result) diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.py index 73b5d59e9b..2b55f4138f 100644 --- a/zilencer/management/commands/populate_db.py +++ b/zilencer/management/commands/populate_db.py @@ -788,6 +788,17 @@ class Command(BaseCommand): deliver_at=timezone_now() + timedelta(days=365), realm=zulip_realm, ) + check_schedule_message( + sender=iago, + client=get_client("populate_db"), + recipient_type_name="private", + message_to=[iago.id], + topic_name=None, + message_content="Note to self: It's been a while since you've provisioned this development environment.", + scheduled_message_id=None, + deliver_at=timezone_now() + timedelta(days=365), + realm=zulip_realm, + ) else: zulip_realm = get_realm("zulip") recipient_streams = [