From abc044e869dbc1bda446e37d4c2bc7bb31c4b6e6 Mon Sep 17 00:00:00 2001 From: Rishi Gupta Date: Fri, 10 Aug 2018 15:48:10 -0700 Subject: [PATCH] billing: Rename RealmAuditLog.REALM_PLAN_STARTED. --- zerver/models.py | 2 +- zilencer/lib/stripe.py | 2 +- zilencer/tests/test_stripe.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zerver/models.py b/zerver/models.py index 0db1c215b8..c7d8a4fd8c 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -2170,7 +2170,7 @@ class RealmAuditLog(models.Model): STRIPE_CUSTOMER_CREATED = 'stripe_customer_created' 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' USER_CREATED = 'user_created' diff --git a/zilencer/lib/stripe.py b/zilencer/lib/stripe.py index 350c87ff54..028ef928dc 100644 --- a/zilencer/lib/stripe.py +++ b/zilencer/lib/stripe.py @@ -167,7 +167,7 @@ def do_subscribe_customer_to_plan(stripe_customer: stripe.Customer, stripe_plan_ RealmAuditLog.objects.create( realm=customer.realm, 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), extra_data=ujson.dumps({'plan': stripe_plan_id, 'quantity': seat_count})) diff --git a/zilencer/tests/test_stripe.py b/zilencer/tests/test_stripe.py index 738256acf6..2ad7d87942 100644 --- a/zilencer/tests/test_stripe.py +++ b/zilencer/tests/test_stripe.py @@ -130,7 +130,7 @@ class StripeTest(ZulipTestCase): self.assertEqual(audit_log_entries, [ (RealmAuditLog.STRIPE_CUSTOMER_CREATED, 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 realm = get_realm("zulip") @@ -202,7 +202,7 @@ class StripeTest(ZulipTestCase): self.assertEqual(audit_log_entries, [ (RealmAuditLog.STRIPE_CUSTOMER_CREATED, 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), ]) self.assertEqual(ujson.loads(RealmAuditLog.objects.filter(