Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
migrations: Don't push events to deferred_work queue if TEST_SUITE.
Mateusz Mandera26f9f3cc4b3d
diff --git a/zerver/migrations/0376_set_realmemoji_author_and_reupload_realmemoji.py b/zerver/migrations/0376_set_realmemoji_author_and_reupload_realmemoji.pyindex 675c2b2506c..e0cc61f3fc3 100644--- a/zerver/migrations/0376_set_realmemoji_author_and_reupload_realmemoji.py+++ b/zerver/migrations/0376_set_realmemoji_author_and_reupload_realmemoji.py@@ -1,3 +1,4 @@+from django.conf import settingsfrom django.db import migrationsfrom django.db.backends.postgresql.schema import DatabaseSchemaEditorfrom django.db.migrations.state import StateApps@@ -10,6 +11,7 @@ def set_emoji_author(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> NoThis migration establishes the invariant that all RealmEmoji objects have .author setand queues events for reuploading all RealmEmoji."""+RealmEmoji = apps.get_model("zerver", "RealmEmoji")Realm = apps.get_model("zerver", "Realm")UserProfile = apps.get_model("zerver", "UserProfile")@@ -30,6 +32,12 @@ def set_emoji_author(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> NoRealmEmoji.objects.bulk_update(realm_emoji_to_update, ["author_id"])+ if settings.TEST_SUITE:+ # There are no custom emoji in the test suite data set, and+ # the below code won't work because RabbitMQ isn't enabled for+ # the test suite.+ return+for realm_id in Realm.objects.order_by("id").values_list("id", flat=True):event = {"type": "reupload_realm_emoji",