billing: Rename RealmAuditLog.REALM_PLAN_STARTED.

This commit is contained in:
Rishi Gupta 2018-08-10 15:48:10 -07:00
parent d33d7e1c28
commit abc044e869
3 changed files with 4 additions and 4 deletions

View File

@ -2170,7 +2170,7 @@ class RealmAuditLog(models.Model):
STRIPE_CUSTOMER_CREATED = 'stripe_customer_created' STRIPE_CUSTOMER_CREATED = 'stripe_customer_created'
STRIPE_CARD_ADDED = 'stripe_card_added' STRIPE_CARD_ADDED = 'stripe_card_added'
REALM_PLAN_STARTED = 'realm_plan_started' STRIPE_PLAN_CHANGED = 'stripe_plan_changed'
REALM_PLAN_QUANTITY_RESET = 'realm_plan_quantity_reset' REALM_PLAN_QUANTITY_RESET = 'realm_plan_quantity_reset'
USER_CREATED = 'user_created' USER_CREATED = 'user_created'

View File

@ -167,7 +167,7 @@ def do_subscribe_customer_to_plan(stripe_customer: stripe.Customer, stripe_plan_
RealmAuditLog.objects.create( RealmAuditLog.objects.create(
realm=customer.realm, realm=customer.realm,
acting_user=customer.billing_user, acting_user=customer.billing_user,
event_type=RealmAuditLog.REALM_PLAN_STARTED, event_type=RealmAuditLog.STRIPE_PLAN_CHANGED,
event_time=timestamp_to_datetime(stripe_subscription.created), event_time=timestamp_to_datetime(stripe_subscription.created),
extra_data=ujson.dumps({'plan': stripe_plan_id, 'quantity': seat_count})) extra_data=ujson.dumps({'plan': stripe_plan_id, 'quantity': seat_count}))

View File

@ -130,7 +130,7 @@ class StripeTest(ZulipTestCase):
self.assertEqual(audit_log_entries, [ self.assertEqual(audit_log_entries, [
(RealmAuditLog.STRIPE_CUSTOMER_CREATED, timestamp_to_datetime(self.customer_created)), (RealmAuditLog.STRIPE_CUSTOMER_CREATED, timestamp_to_datetime(self.customer_created)),
(RealmAuditLog.STRIPE_CARD_ADDED, timestamp_to_datetime(self.customer_created)), (RealmAuditLog.STRIPE_CARD_ADDED, timestamp_to_datetime(self.customer_created)),
(RealmAuditLog.REALM_PLAN_STARTED, timestamp_to_datetime(self.subscription_created)), (RealmAuditLog.STRIPE_PLAN_CHANGED, timestamp_to_datetime(self.subscription_created)),
]) ])
# Check that we correctly updated Realm # Check that we correctly updated Realm
realm = get_realm("zulip") realm = get_realm("zulip")
@ -202,7 +202,7 @@ class StripeTest(ZulipTestCase):
self.assertEqual(audit_log_entries, [ self.assertEqual(audit_log_entries, [
(RealmAuditLog.STRIPE_CUSTOMER_CREATED, timestamp_to_datetime(self.customer_created), False), (RealmAuditLog.STRIPE_CUSTOMER_CREATED, timestamp_to_datetime(self.customer_created), False),
(RealmAuditLog.STRIPE_CARD_ADDED, timestamp_to_datetime(self.customer_created), False), (RealmAuditLog.STRIPE_CARD_ADDED, timestamp_to_datetime(self.customer_created), False),
(RealmAuditLog.REALM_PLAN_STARTED, timestamp_to_datetime(self.subscription_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.REALM_PLAN_QUANTITY_RESET, timestamp_to_datetime(self.subscription_created), True),
]) ])
self.assertEqual(ujson.loads(RealmAuditLog.objects.filter( self.assertEqual(ujson.loads(RealmAuditLog.objects.filter(