mirror of https://github.com/zulip/zulip.git
settings: Use original FREE_TRIAL_DAYS for cloud free trials.
* Renamed FREE_TRIAL_DAYS to CLOUD_FREE_TRIAL_DAYS. * Used `cloud_free_trial_days` to get free trial days secret.
This commit is contained in:
parent
34704daee7
commit
ccd60bc7e2
|
@ -3628,11 +3628,11 @@ def compute_plan_parameters(
|
|||
|
||||
|
||||
def get_free_trial_days() -> Optional[int]:
|
||||
return settings.FREE_TRIAL_DAYS
|
||||
return settings.CLOUD_FREE_TRIAL_DAYS
|
||||
|
||||
|
||||
def is_free_trial_offer_enabled() -> bool:
|
||||
return settings.FREE_TRIAL_DAYS not in (None, 0)
|
||||
return settings.CLOUD_FREE_TRIAL_DAYS not in (None, 0)
|
||||
|
||||
|
||||
def ensure_customer_does_not_have_active_plan(customer: Customer) -> None:
|
||||
|
|
|
@ -1033,7 +1033,7 @@ class StripeTest(StripeTestCase):
|
|||
user = self.example_user("hamlet")
|
||||
self.login_user(user)
|
||||
|
||||
with self.settings(FREE_TRIAL_DAYS=60):
|
||||
with self.settings(CLOUD_FREE_TRIAL_DAYS=60):
|
||||
response = self.client_get("/upgrade/")
|
||||
free_trial_end_date = self.now + timedelta(days=60)
|
||||
|
||||
|
@ -1253,7 +1253,7 @@ class StripeTest(StripeTestCase):
|
|||
self.login_user(user)
|
||||
|
||||
free_trial_end_date = self.now + timedelta(days=60)
|
||||
with self.settings(FREE_TRIAL_DAYS=60):
|
||||
with self.settings(CLOUD_FREE_TRIAL_DAYS=60):
|
||||
response = self.client_get("/upgrade/")
|
||||
|
||||
self.assert_in_success_response(
|
||||
|
@ -1992,7 +1992,7 @@ class StripeTest(StripeTestCase):
|
|||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(response["Location"], "http://zulip.testserver/billing")
|
||||
|
||||
with self.settings(FREE_TRIAL_DAYS=30):
|
||||
with self.settings(CLOUD_FREE_TRIAL_DAYS=30):
|
||||
response = self.client_get("/upgrade/")
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(response["Location"], "http://zulip.testserver/billing")
|
||||
|
@ -2889,7 +2889,7 @@ class StripeTest(StripeTestCase):
|
|||
self.login_user(user)
|
||||
|
||||
free_trial_end_date = self.now + timedelta(days=60)
|
||||
with self.settings(FREE_TRIAL_DAYS=60):
|
||||
with self.settings(CLOUD_FREE_TRIAL_DAYS=60):
|
||||
with time_machine.travel(self.now, tick=False):
|
||||
self.add_card_and_upgrade(user, schedule="monthly")
|
||||
plan = CustomerPlan.objects.get()
|
||||
|
@ -2944,7 +2944,7 @@ class StripeTest(StripeTestCase):
|
|||
self.login_user(user)
|
||||
|
||||
free_trial_end_date = self.now + timedelta(days=60)
|
||||
with self.settings(FREE_TRIAL_DAYS=60):
|
||||
with self.settings(CLOUD_FREE_TRIAL_DAYS=60):
|
||||
with time_machine.travel(self.now, tick=False):
|
||||
self.add_card_and_upgrade(user, schedule="annual")
|
||||
plan = CustomerPlan.objects.get()
|
||||
|
@ -2996,7 +2996,7 @@ class StripeTest(StripeTestCase):
|
|||
user = self.example_user("hamlet")
|
||||
|
||||
free_trial_end_date = self.now + timedelta(days=60)
|
||||
with self.settings(FREE_TRIAL_DAYS=60):
|
||||
with self.settings(CLOUD_FREE_TRIAL_DAYS=60):
|
||||
with time_machine.travel(self.now, tick=False):
|
||||
self.local_upgrade(
|
||||
self.seat_count, True, CustomerPlan.BILLING_SCHEDULE_ANNUAL, False, True
|
||||
|
@ -3048,7 +3048,7 @@ class StripeTest(StripeTestCase):
|
|||
self.login_user(user)
|
||||
|
||||
free_trial_end_date = self.now + timedelta(days=60)
|
||||
with self.settings(FREE_TRIAL_DAYS=60):
|
||||
with self.settings(CLOUD_FREE_TRIAL_DAYS=60):
|
||||
with time_machine.travel(self.now, tick=False):
|
||||
self.local_upgrade(
|
||||
self.seat_count, True, CustomerPlan.BILLING_SCHEDULE_ANNUAL, False, True
|
||||
|
@ -3159,7 +3159,7 @@ class StripeTest(StripeTestCase):
|
|||
self.login_user(user)
|
||||
|
||||
free_trial_end_date = self.now + timedelta(days=60)
|
||||
with self.settings(FREE_TRIAL_DAYS=60):
|
||||
with self.settings(CLOUD_FREE_TRIAL_DAYS=60):
|
||||
with time_machine.travel(self.now, tick=False):
|
||||
self.local_upgrade(
|
||||
self.seat_count, True, CustomerPlan.BILLING_SCHEDULE_ANNUAL, False, True
|
||||
|
|
|
@ -69,10 +69,10 @@ a few things to keep in mind while conducting these tests manually:
|
|||
|
||||
Here are some flows to test when upgrading a Zulip organization:
|
||||
|
||||
- When free trials are not enabled, i.e. `FREE_TRIAL_DAYS` is not set
|
||||
- When free trials are not enabled, i.e. `CLOUD_FREE_TRIAL_DAYS` is not set
|
||||
to any value in `dev_settings.py` (aka the default). You can
|
||||
double-check that the setting is disabled by verifying
|
||||
`./scripts/get-django-setting FREE_TRIAL_DAYS` returns 0.
|
||||
`./scripts/get-django-setting CLOUD_FREE_TRIAL_DAYS` returns 0.
|
||||
|
||||
- Using a valid card number like `4242 4242 4242 4242`.
|
||||
- Using an invalid card number like `4000000000000341`, which will add the card
|
||||
|
@ -84,7 +84,7 @@ Here are some flows to test when upgrading a Zulip organization:
|
|||
- Upgrade an organization when free trials are enabled. The free
|
||||
trials setting has been (possibly permanently) disabled in
|
||||
production for some time now, so testing this code path is not a
|
||||
priority. You can set `FREE_TRIAL_DAYS` to any number greater than
|
||||
priority. You can set `CLOUD_FREE_TRIAL_DAYS` to any number greater than
|
||||
`0` in `dev_settings.py` to enable free trials. There are two
|
||||
different flows to test here:
|
||||
- Right after the organization is created by following the instructions in the
|
||||
|
|
|
@ -575,7 +575,7 @@ class PlansPageTest(ZulipTestCase):
|
|||
self.assert_in_success_response([current_plan, upgrade_to_standard], result)
|
||||
self.assert_not_in_success_response([sign_up_now, sponsorship_pending], result)
|
||||
|
||||
with self.settings(FREE_TRIAL_DAYS=60):
|
||||
with self.settings(CLOUD_FREE_TRIAL_DAYS=60):
|
||||
result = self.client_get("/plans/", subdomain="zulip")
|
||||
self.assert_in_success_response([current_plan, "Start 60-day free trial"], result)
|
||||
self.assert_not_in_success_response(
|
||||
|
|
|
@ -1754,7 +1754,7 @@ class RealmCreationTest(ZulipTestCase):
|
|||
self.assert_length(messages, message_count)
|
||||
self.assertIn(text, messages[0].content)
|
||||
|
||||
@override_settings(OPEN_REALM_CREATION=True, FREE_TRIAL_DAYS=30)
|
||||
@override_settings(OPEN_REALM_CREATION=True, CLOUD_FREE_TRIAL_DAYS=30)
|
||||
def test_create_realm_during_free_trial(self) -> None:
|
||||
password = "test"
|
||||
string_id = "custom-test"
|
||||
|
|
|
@ -546,7 +546,7 @@ ARCHIVED_DATA_VACUUMING_DELAY_DAYS = 30
|
|||
# are available to all realms.
|
||||
BILLING_ENABLED = False
|
||||
|
||||
FREE_TRIAL_DAYS: Optional[int] = int(get_secret("free_trial_days", "0"))
|
||||
CLOUD_FREE_TRIAL_DAYS: Optional[int] = int(get_secret("cloud_free_trial_days", "0"))
|
||||
|
||||
# Custom message (supports HTML) to be shown in the navbar of landing pages. Used mainly for
|
||||
# making announcements.
|
||||
|
|
|
@ -257,7 +257,7 @@ RATE_LIMITING_RULES: Dict[str, List[Tuple[int, int]]] = {
|
|||
"password_reset_form_by_email": [],
|
||||
}
|
||||
|
||||
FREE_TRIAL_DAYS: Optional[int] = None
|
||||
CLOUD_FREE_TRIAL_DAYS: Optional[int] = None
|
||||
|
||||
SCIM_CONFIG: Dict[str, SCIMConfigDict] = {
|
||||
"zulip": {
|
||||
|
|
Loading…
Reference in New Issue