Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
populate_db: Create RemoteZulipServer with proper details from settings.
Mateusz Mandera8b55d60f9e03
diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.pyindex 77479fbe529..52fd2b80c17 100644--- a/zerver/lib/test_classes.py+++ b/zerver/lib/test_classes.py@@ -2385,11 +2385,12 @@ def get_topic_messages(user_profile: UserProfile, stream: Stream, topic_name: stclass BouncerTestCase(ZulipTestCase):@overridedef setUp(self) -> None:- # Set a deterministic uuid for convenience.+ # Set a deterministic uuid and a nice hostname for convenience.self.server_uuid = "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"self.server = RemoteZulipServer.objects.all().latest("id")self.server.uuid = self.server_uuid+ self.server.hostname = "demo.example.com"self.server.save()super().setUp()diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.pyindex b4b713a45f2..c1edf3fa08c 100644--- a/zilencer/management/commands/populate_db.py+++ b/zilencer/management/commands/populate_db.py@@ -1,7 +1,6 @@import itertoolsimport osimport random-import uuidfrom collections import defaultdictfrom datetime import datetime, timedeltafrom typing import Any, Dict, List, Mapping, Sequence, Tuple@@ -381,10 +380,13 @@ class Command(BaseCommand):# with the bouncer, which is going to be the primary case for modern servers. Tests# wanting to have missing registrations, or simulating legacy server scenarios,# should delete RemoteRealms to explicit set things up.++ assert isinstance(settings.ZULIP_ORG_ID, str)+ assert isinstance(settings.ZULIP_ORG_KEY, str)server = RemoteZulipServer.objects.create(- uuid=uuid.uuid4(),- api_key="magic_secret_api_key",- hostname="demo.example.com",+ uuid=settings.ZULIP_ORG_ID,+ api_key=settings.ZULIP_ORG_KEY,+ hostname=settings.EXTERNAL_HOST,last_updated=timezone_now(),)update_remote_realm_data_for_server(server, get_realms_info_for_push_bouncer())