demo-org: Make default org type education for dev demo orgs.

We plan on requiring setting an organization type when registering
a demo org, so instead of setting the type to unspecified in the
dev environment when creating demo orgs, we now set it to be an
education org by default.

Updates signup tests so that both education demo and permanent
organization Welcome Bot messages are confirmed.
This commit is contained in:
Lauryn Menard 2025-10-02 17:16:24 +02:00 committed by Tim Abbott
parent 365f23df16
commit e978e0c7ec
2 changed files with 16 additions and 5 deletions

View File

@ -1812,7 +1812,7 @@ class RealmCreationTest(ZulipTestCase):
self.assertNotIn("I've kicked off some conversations", welcome_msg.content)
@override_settings(OPEN_REALM_CREATION=True)
def test_create_education_demo_organization_welcome_bot_direct_message(self) -> None:
def test_create_education_organization_welcome_bot_direct_message(self) -> None:
password = "test"
string_id = "custom-test"
email = "user1@test.com"
@ -1846,7 +1846,6 @@ class RealmCreationTest(ZulipTestCase):
realm_name=realm_name,
enable_marketing_emails=False,
realm_type=Realm.ORG_TYPES["education"]["id"],
is_demo_organization=True,
)
self.assertEqual(result.status_code, 302)
@ -1858,10 +1857,9 @@ class RealmCreationTest(ZulipTestCase):
).latest("id")
self.assertTrue(welcome_msg.content.startswith("Hello, and welcome to Zulip!"))
# Organization type is education, and organization is a demo organization.
# Organization type is education.
self.assertNotIn("getting started guide", welcome_msg.content)
self.assertIn("using Zulip for a class guide", welcome_msg.content)
self.assertIn("demo organization", welcome_msg.content)
@override_settings(OPEN_REALM_CREATION=True)
def test_create_realm_with_custom_language(self) -> None:
@ -4545,6 +4543,19 @@ class UserSignUpTest(ZulipTestCase):
)
self.assertEqual(realm.demo_organization_scheduled_deletion_date, expected_deletion_date)
# Make sure the correct Welcome Bot direct message is sent.
welcome_msg = Message.objects.filter(
realm_id=realm.id,
sender__email="welcome-bot@zulip.com",
recipient__type=Recipient.PERSONAL,
).latest("id")
self.assertTrue(welcome_msg.content.startswith("Hello, and welcome to Zulip!"))
# Organization type is education, and organization is a demo organization.
self.assertNotIn("getting started guide", welcome_msg.content)
self.assertIn("using Zulip for a class guide", welcome_msg.content)
self.assertIn("demo organization", welcome_msg.content)
def test_get_default_language_for_new_user(self) -> None:
realm = get_realm("zulip")
req = HostRequestMock()

View File

@ -100,7 +100,7 @@ def register_demo_development_realm(request: HttpRequest) -> HttpResponse:
email = ""
realm_default_language = "en"
realm_name = generate_demo_realm_name()
realm_type = Realm.ORG_TYPES["unspecified"]["id"]
realm_type = Realm.ORG_TYPES["education"]["id"]
realm_subdomain = realm_name
email_address_visibility = orjson.dumps(UserProfile.EMAIL_ADDRESS_VISIBILITY_NOBODY)
prereg_realm = create_preregistration_realm(