diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py index c8da9c32ab..ec11b8415e 100644 --- a/corporate/tests/test_stripe.py +++ b/corporate/tests/test_stripe.py @@ -625,7 +625,9 @@ class StripeTest(ZulipTestCase): with patch('corporate.lib.stripe.preview_invoice_total_for_downgrade', return_value=1): process_downgrade(user) stripe_customer = stripe_get_customer(Customer.objects.get(realm=user.realm).stripe_customer_id) - self.assertIn('Unknown payment method.', payment_method_string(stripe_customer)) + # Could be either one, depending on exact timing with the test + self.assertTrue('Unknown payment method' in payment_method_string(stripe_customer) or + 'No payment method' in payment_method_string(stripe_customer)) @mock_stripe("Customer.save", "Customer.retrieve", "Customer.create", "Invoice.upcoming", "Token.create", "Charge.list", "Subscription.create") diff --git a/corporate/views.py b/corporate/views.py index a9912b6781..05ebffd7e8 100644 --- a/corporate/views.py +++ b/corporate/views.py @@ -64,7 +64,7 @@ def payment_method_string(stripe_customer: stripe.Customer) -> str: # do for a particular customer that would land them here. E.g. by default we # don't support ACH for automatic payments, but in theory we could add it for # a customer via the Stripe dashboard. - return _("Unknown payment method. Please contact %s." % (settings.ZULIP_ADMINISTRATOR,)) + return _("Unknown payment method. Please contact %s." % (settings.ZULIP_ADMINISTRATOR,)) # nocoverage @zulip_login_required def initial_upgrade(request: HttpRequest) -> HttpResponse: