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: Freeze time around the tier upgrade support view request.

Aman Agrawal8ec803a038d0
diff --git a/corporate/tests/stripe_fixtures/switch_realm_from_standard_to_plus_plan--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/switch_realm_from_standard_to_plus_plan--Invoice.finalize_invoice.2.json
index 9797ee1eb97..830f7271d73 100644
--- a/corporate/tests/stripe_fixtures/switch_realm_from_standard_to_plus_plan--Invoice.finalize_invoice.2.json
+++ b/corporate/tests/stripe_fixtures/switch_realm_from_standard_to_plus_plan--Invoice.finalize_invoice.2.json
@@ -77,8 +77,8 @@
"type": "invoice_item_details"
},
"period": {
- "end": 1000000000,
- "start": 1000000000
+ "end": 1357095845,
+ "start": 1325473445
},
"pretax_credit_amounts": [],
"pricing": {
diff --git a/corporate/tests/stripe_fixtures/switch_realm_from_standard_to_plus_plan--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/switch_realm_from_standard_to_plus_plan--InvoiceItem.create.2.json
index 3a5eaf210ba..a9b502e2dac 100644
--- a/corporate/tests/stripe_fixtures/switch_realm_from_standard_to_plus_plan--InvoiceItem.create.2.json
+++ b/corporate/tests/stripe_fixtures/switch_realm_from_standard_to_plus_plan--InvoiceItem.create.2.json
@@ -14,8 +14,8 @@
"object": "invoiceitem",
"parent": null,
"period": {
- "end": 1000000000,
- "start": 1000000000
+ "end": 1357095845,
+ "start": 1325473445
},
"pricing": {
"price_details": {
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index a7f40d31c4f..8aefb5bcece 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -6789,7 +6789,11 @@ class TestSupportBillingHelpers(StripeTestCase):
plan_modification="upgrade_plan_tier",
new_plan_tier=CustomerPlan.TIER_CLOUD_PLUS,
)
- success_message = billing_session.process_support_view_request(support_request)
+ # Freeze time so the prorated credit (computed inside
+ # ``change_plan_tier`` from ``timezone_now()``) doesn't drift
+ # between fixture regenerations.
+ with time_machine.travel(self.now, tick=False):
+ success_message = billing_session.process_support_view_request(support_request)
self.assertEqual(success_message, "zulip upgraded to Zulip Cloud Plus")
customer.refresh_from_db()
new_plan = get_current_plan_by_customer(customer)