Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test-stripe: Confirm update of plan type for fixed-price plan upgrade.

Lauryn Menard746268e87824
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index f2e21710f63..e9ebe5348f1 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -7829,6 +7829,8 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
)
customer = Customer.objects.get(stripe_customer_id=stripe_customer.id)
+ assert customer.remote_realm is not None
+ self.assertEqual(customer.remote_realm.plan_type, RemoteRealm.PLAN_TYPE_BASIC)
current_plan = CustomerPlan.objects.get(customer=customer, status=CustomerPlan.ACTIVE)
self.assertEqual(current_plan.tier, CustomerPlan.TIER_SELF_HOSTED_BASIC)
self.assertIsNone(current_plan.fixed_price)
@@ -7901,6 +7903,9 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
self.assertIsNotNone(new_plan.fixed_price)
self.assertIsNone(new_plan.price_per_license)
+ customer.refresh_from_db()
+ self.assertEqual(customer.remote_realm.plan_type, RemoteRealm.PLAN_TYPE_BUSINESS)
+
self.logout()
self.login("hamlet")
hamlet = self.example_user("hamlet")
@@ -9692,6 +9697,8 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):
)
customer = Customer.objects.get(stripe_customer_id=stripe_customer.id)
+ assert customer.remote_server is not None
+ self.assertEqual(customer.remote_server.plan_type, RemoteZulipServer.PLAN_TYPE_BASIC)
current_plan = CustomerPlan.objects.get(customer=customer, status=CustomerPlan.ACTIVE)
self.assertEqual(current_plan.tier, CustomerPlan.TIER_SELF_HOSTED_BASIC)
self.assertIsNone(current_plan.fixed_price)
@@ -9754,6 +9761,9 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):
self.assertIsNotNone(new_plan.fixed_price)
self.assertIsNone(new_plan.price_per_license)
+ customer.refresh_from_db()
+ self.assertEqual(customer.remote_server.plan_type, RemoteZulipServer.PLAN_TYPE_BUSINESS)
+
self.logout()
self.login("hamlet")
hamlet = self.example_user("hamlet")