mirror of https://github.com/zulip/zulip.git
populate-db: Add scheduled message to test database.
Prep commit for adding the scheduled-message endpoints to the API documentation. Adds a scheduled message for Iago in the test database so that it can be deleted in the delete cURL example in the api-test suite.
This commit is contained in:
parent
bd2545b0d7
commit
15c6d67e9c
|
@ -440,7 +440,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(46):
|
||||
with self.assert_database_query_count(48):
|
||||
with patch("zerver.lib.cache.cache_set") as cache_mock:
|
||||
result = self._get_home_page()
|
||||
self.check_rendered_logged_in_app(result)
|
||||
|
|
|
@ -26,6 +26,7 @@ from zerver.actions.custom_profile_fields import (
|
|||
)
|
||||
from zerver.actions.message_send import build_message_send_dict, do_send_messages
|
||||
from zerver.actions.realm_emoji import check_add_realm_emoji
|
||||
from zerver.actions.scheduled_messages import check_schedule_message
|
||||
from zerver.actions.streams import bulk_add_subscriptions
|
||||
from zerver.actions.user_groups import create_user_group_in_database
|
||||
from zerver.actions.users import do_change_user_role
|
||||
|
@ -774,6 +775,19 @@ class Command(BaseCommand):
|
|||
{"id": pronouns.id, "value": "he/him"},
|
||||
],
|
||||
)
|
||||
# We need to create at least one scheduled message for Iago for the api-test
|
||||
# cURL example to delete an existing scheduled message.
|
||||
check_schedule_message(
|
||||
sender=iago,
|
||||
client=get_client("populate_db"),
|
||||
recipient_type_name="stream",
|
||||
message_to=[Stream.objects.get(name="Denmark", realm=zulip_realm).id],
|
||||
topic_name="test-api",
|
||||
message_content="It's time to celebrate the anniversary of provisioning this development environment :tada:!",
|
||||
scheduled_message_id=None,
|
||||
deliver_at=timezone_now() + timedelta(days=365),
|
||||
realm=zulip_realm,
|
||||
)
|
||||
else:
|
||||
zulip_realm = get_realm("zulip")
|
||||
recipient_streams = [
|
||||
|
|
Loading…
Reference in New Issue