billing: Rename RealmAuditLog.REALM_PLAN_QUANTITY_RESET.

This commit is contained in:
Rishi Gupta 2018-08-10 15:51:18 -07:00
parent abc044e869
commit 2855864f54
3 changed files with 5 additions and 5 deletions

View File

@ -2171,7 +2171,7 @@ class RealmAuditLog(models.Model):
STRIPE_CUSTOMER_CREATED = 'stripe_customer_created'
STRIPE_CARD_ADDED = 'stripe_card_added'
STRIPE_PLAN_CHANGED = 'stripe_plan_changed'
REALM_PLAN_QUANTITY_RESET = 'realm_plan_quantity_reset'
STRIPE_PLAN_QUANTITY_RESET = 'stripe_plan_quantity_reset'
USER_CREATED = 'user_created'
USER_ACTIVATED = 'user_activated'

View File

@ -175,7 +175,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.REALM_PLAN_QUANTITY_RESET,
event_type=RealmAuditLog.STRIPE_PLAN_QUANTITY_RESET,
event_time=timestamp_to_datetime(stripe_subscription.created),
requires_billing_update=True,
extra_data=ujson.dumps({'quantity': current_seat_count}))

View File

@ -194,7 +194,7 @@ class StripeTest(ZulipTestCase):
}],
prorate=True,
tax_percent=0)
# Check that we have the REALM_PLAN_QUANTITY_RESET entry, and that we
# Check that we have the STRIPE_PLAN_QUANTITY_RESET 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',
@ -203,10 +203,10 @@ class StripeTest(ZulipTestCase):
(RealmAuditLog.STRIPE_CUSTOMER_CREATED, timestamp_to_datetime(self.customer_created), False),
(RealmAuditLog.STRIPE_CARD_ADDED, timestamp_to_datetime(self.customer_created), False),
(RealmAuditLog.STRIPE_PLAN_CHANGED, timestamp_to_datetime(self.subscription_created), False),
(RealmAuditLog.REALM_PLAN_QUANTITY_RESET, timestamp_to_datetime(self.subscription_created), True),
(RealmAuditLog.STRIPE_PLAN_QUANTITY_RESET, timestamp_to_datetime(self.subscription_created), True),
])
self.assertEqual(ujson.loads(RealmAuditLog.objects.filter(
event_type=RealmAuditLog.REALM_PLAN_QUANTITY_RESET).values_list('extra_data', flat=True).first()),
event_type=RealmAuditLog.STRIPE_PLAN_QUANTITY_RESET).values_list('extra_data', flat=True).first()),
{'quantity': new_seat_count})
def test_upgrade_with_tampered_seat_count(self) -> None: