From 51c82b6d4fb586a3decb78a4248bffbde72009ee Mon Sep 17 00:00:00 2001 From: Vishnu Ks Date: Wed, 25 Jul 2018 20:42:24 +0530 Subject: [PATCH] models: Rename PLAN_QUANITY_UPDATED event type. --- zerver/models.py | 2 +- zilencer/lib/stripe.py | 2 +- zilencer/tests/test_stripe.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zerver/models.py b/zerver/models.py index 5b7c1917e1..164b6bc9cd 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -2161,7 +2161,7 @@ class RealmAuditLog(models.Model): REALM_STRIPE_INITIALIZED = 'realm_stripe_initialized' REALM_CARD_ADDED = 'realm_card_added' REALM_PLAN_STARTED = 'realm_plan_started' - PLAN_QUANTITY_UPDATED = 'plan_quantity_updated' + REALM_PLAN_QUANTITY_UPDATED = 'realm_plan_quantity_updated' USER_CREATED = 'user_created' USER_ACTIVATED = 'user_activated' diff --git a/zilencer/lib/stripe.py b/zilencer/lib/stripe.py index 2b1fbaba43..715ab23428 100644 --- a/zilencer/lib/stripe.py +++ b/zilencer/lib/stripe.py @@ -174,7 +174,7 @@ def do_subscribe_customer_to_plan(stripe_customer: stripe.Customer, stripe_plan_ if seat_count != current_seat_count: RealmAuditLog.objects.create( realm=customer.realm, - event_type=RealmAuditLog.PLAN_QUANTITY_UPDATED, + event_type=RealmAuditLog.REALM_PLAN_QUANTITY_UPDATED, event_time=timestamp_to_datetime(stripe_subscription.created), requires_billing_update=True, extra_data=ujson.dumps({'quantity': current_seat_count})) diff --git a/zilencer/tests/test_stripe.py b/zilencer/tests/test_stripe.py index 81ac53b70f..267a15183c 100644 --- a/zilencer/tests/test_stripe.py +++ b/zilencer/tests/test_stripe.py @@ -198,7 +198,7 @@ class StripeTest(ZulipTestCase): }], prorate=True, tax_percent=0) - # Check that we have the PLAN_QUANTITY_UPDATED entry, and that we + # Check that we have the REALM_PLAN_QUANTITY_UPDATED entry, and that we # correctly handled the requires_billing_update field audit_log_entries = list(RealmAuditLog.objects.order_by('-id') .values_list('event_type', 'event_time', @@ -207,10 +207,10 @@ class StripeTest(ZulipTestCase): (RealmAuditLog.REALM_STRIPE_INITIALIZED, timestamp_to_datetime(self.customer_created), False), (RealmAuditLog.REALM_CARD_ADDED, timestamp_to_datetime(self.customer_created), False), (RealmAuditLog.REALM_PLAN_STARTED, timestamp_to_datetime(self.subscription_created), False), - (RealmAuditLog.PLAN_QUANTITY_UPDATED, timestamp_to_datetime(self.subscription_created), True), + (RealmAuditLog.REALM_PLAN_QUANTITY_UPDATED, timestamp_to_datetime(self.subscription_created), True), ]) self.assertEqual(ujson.loads(RealmAuditLog.objects.filter( - event_type=RealmAuditLog.PLAN_QUANTITY_UPDATED).values_list('extra_data', flat=True).first()), + event_type=RealmAuditLog.REALM_PLAN_QUANTITY_UPDATED).values_list('extra_data', flat=True).first()), {'quantity': new_seat_count}) @mock.patch("zilencer.lib.stripe.STRIPE_PUBLISHABLE_KEY", "stripe_publishable_key")