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.

tests: Check for microsecond rounding in compute_plan_parameters.

Vijay Hiremath1acce499b990
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index 8cd59354df2..dc4aef62242 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -5604,7 +5604,6 @@ class BillingHelpersTest(ZulipTestCase):
self.assertEqual(next_month(anchor, last), next_)
def test_compute_plan_parameters(self) -> None:
- # TODO: test rounding down microseconds
anchor = datetime(2019, 12, 31, 1, 2, 3, tzinfo=timezone.utc)
month_later = datetime(2020, 1, 31, 1, 2, 3, tzinfo=timezone.utc)
year_later = datetime(2020, 12, 31, 1, 2, 3, tzinfo=timezone.utc)
@@ -5689,7 +5688,8 @@ class BillingHelpersTest(ZulipTestCase):
(anchor, month_later, month_later, 1200),
),
]
- with time_machine.travel(anchor, tick=False):
+ # compute_plan_parameters truncates microseconds in the anchor datetime.
+ with time_machine.travel(anchor + timedelta(microseconds=654321), tick=False):
for (tier, billing_schedule, customer), output in test_cases:
output_ = compute_plan_parameters(
tier,