models: Rename PLAN_QUANITY_UPDATED event type.

This commit is contained in:
Vishnu Ks 2018-07-25 20:42:24 +05:30 committed by Rishi Gupta
parent 975969aa89
commit 51c82b6d4f
3 changed files with 5 additions and 5 deletions

View File

@ -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'

View File

@ -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}))

View File

@ -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")