mirror of https://github.com/zulip/zulip.git
billing: Fix test flake in test_payment_method_string.
This commit is contained in:
parent
1ba037201c
commit
5a47ac96de
|
@ -625,7 +625,9 @@ class StripeTest(ZulipTestCase):
|
||||||
with patch('corporate.lib.stripe.preview_invoice_total_for_downgrade', return_value=1):
|
with patch('corporate.lib.stripe.preview_invoice_total_for_downgrade', return_value=1):
|
||||||
process_downgrade(user)
|
process_downgrade(user)
|
||||||
stripe_customer = stripe_get_customer(Customer.objects.get(realm=user.realm).stripe_customer_id)
|
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",
|
@mock_stripe("Customer.save", "Customer.retrieve", "Customer.create", "Invoice.upcoming",
|
||||||
"Token.create", "Charge.list", "Subscription.create")
|
"Token.create", "Charge.list", "Subscription.create")
|
||||||
|
|
|
@ -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
|
# 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
|
# don't support ACH for automatic payments, but in theory we could add it for
|
||||||
# a customer via the Stripe dashboard.
|
# 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
|
@zulip_login_required
|
||||||
def initial_upgrade(request: HttpRequest) -> HttpResponse:
|
def initial_upgrade(request: HttpRequest) -> HttpResponse:
|
||||||
|
|
Loading…
Reference in New Issue