settings: Add constant for demo org deadlines.

We set the 30 days deadline timedelta for demo orgs as a constant
in default_settings.py so that it can be overridden in tests.
This commit is contained in:
Eeshan Garg 2021-09-01 19:05:30 -04:00 committed by Tim Abbott
parent 787f22a692
commit f5c26990c2
3 changed files with 7 additions and 2 deletions

View File

@ -4964,7 +4964,7 @@ def do_create_realm(
realm = Realm(string_id=string_id, name=name, **kwargs)
if is_demo_organization:
realm.demo_organization_scheduled_deletion_date = (
realm.date_created + datetime.timedelta(days=30)
realm.date_created + datetime.timedelta(days=settings.DEMO_ORG_DEADLINE_DAYS)
)
realm.save()

View File

@ -5180,7 +5180,9 @@ class UserSignUpTest(InviteUserBase):
assert user_profile is not None
self.assert_logged_in_user_id(user_profile.id)
expected_deletion_date = realm.date_created + datetime.timedelta(days=30)
expected_deletion_date = realm.date_created + datetime.timedelta(
days=settings.DEMO_ORG_DEADLINE_DAYS
)
self.assertEqual(realm.demo_organization_scheduled_deletion_date, expected_deletion_date)

View File

@ -266,6 +266,9 @@ OPEN_REALM_CREATION = False
# purpose now that the REALMS_HAVE_SUBDOMAINS migration is finished.
SYSTEM_ONLY_REALMS = {"zulip"}
# Default deadline for demo organizations
DEMO_ORG_DEADLINE_DAYS = 30
# Alternate hostnames to serve particular realms on, in addition to
# their usual subdomains. Keys are realm string_ids (aka subdomains),
# and values are alternate hosts.