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).
This commit is contained in:
Lauryn Menard 2023-05-16 21:08:33 +02:00 committed by Tim Abbott
parent 61f7ede43c
commit 7af5ceb1c5
2 changed files with 12 additions and 1 deletions

View File

@ -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)

View File

@ -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 = [