billing: Rename MAX_INVITES_PREMIUM.

Largely to have parallel structure with INVITES_DEFAULT_REALM_DAILY_MAX.
This commit is contained in:
Rishi Gupta 2018-10-23 10:30:17 -07:00 committed by Tim Abbott
parent a7fe6b1c34
commit fbd884f934
4 changed files with 6 additions and 6 deletions

View File

@ -247,7 +247,7 @@ class StripeTest(ZulipTestCase):
realm = get_realm("zulip")
self.assertTrue(realm.has_seat_based_plan)
self.assertEqual(realm.plan_type, Realm.PREMIUM)
self.assertEqual(realm.max_invites, Realm.MAX_INVITES_PREMIUM)
self.assertEqual(realm.max_invites, Realm.INVITES_PREMIUM_REALM_DAILY_MAX)
# Check that we can no longer access /upgrade
response = self.client_get("/upgrade/")
self.assertEqual(response.status_code, 302)

View File

@ -3070,9 +3070,9 @@ def do_change_plan_type(user: UserProfile, plan_type: int) -> None:
extra_data={'old_value': old_value, 'new_value': plan_type})
if plan_type == Realm.PREMIUM:
realm.max_invites = Realm.MAX_INVITES_PREMIUM
realm.max_invites = Realm.INVITES_PREMIUM_REALM_DAILY_MAX
elif plan_type == Realm.PREMIUM_FREE:
realm.max_invites = Realm.MAX_INVITES_PREMIUM
realm.max_invites = Realm.INVITES_PREMIUM_REALM_DAILY_MAX
elif plan_type == Realm.LIMITED:
realm.max_invites = settings.INVITES_DEFAULT_REALM_DAILY_MAX
realm.save(update_fields=['_max_invites'])

View File

@ -143,7 +143,7 @@ class Realm(models.Model):
MAX_REALM_SUBDOMAIN_LENGTH = 40
MAX_VIDEO_CHAT_PROVIDER_LENGTH = 40
MAX_GOOGLE_HANGOUTS_DOMAIN_LENGTH = 255 # This is just the maximum domain length by RFC
MAX_INVITES_PREMIUM = 3000
INVITES_PREMIUM_REALM_DAILY_MAX = 3000
VIDEO_CHAT_PROVIDERS = [u"Jitsi", u"Google Hangouts"]
AUTHENTICATION_FLAGS = [u'Google', u'Email', u'GitHub', u'LDAP', u'Dev', u'RemoteUser']
SUBDOMAIN_FOR_ROOT_DOMAIN = ''

View File

@ -352,11 +352,11 @@ class RealmTest(ZulipTestCase):
user = self.example_user('iago')
self.assertEqual(get_realm('zulip').max_invites, settings.INVITES_DEFAULT_REALM_DAILY_MAX)
do_change_plan_type(user, Realm.PREMIUM)
self.assertEqual(get_realm('zulip').max_invites, Realm.MAX_INVITES_PREMIUM)
self.assertEqual(get_realm('zulip').max_invites, Realm.INVITES_PREMIUM_REALM_DAILY_MAX)
do_change_plan_type(user, Realm.LIMITED)
self.assertEqual(get_realm('zulip').max_invites, settings.INVITES_DEFAULT_REALM_DAILY_MAX)
do_change_plan_type(user, Realm.PREMIUM_FREE)
self.assertEqual(get_realm('zulip').max_invites, Realm.MAX_INVITES_PREMIUM)
self.assertEqual(get_realm('zulip').max_invites, Realm.INVITES_PREMIUM_REALM_DAILY_MAX)
class RealmAPITest(ZulipTestCase):