mirror of
https://github.com/zulip/zulip.git
synced 2025-10-28 18:43:52 +00:00
billing: Don't check for stripe key and plan objects in tests.
Stripe already returns an appropriate error in prod, and these checks are just a hassle in tests. Also fixes an error where the check for Plan.objects.exists() was missing a "not".
This commit is contained in:
@@ -69,15 +69,14 @@ class StripeError(JsonableError):
|
||||
def catch_stripe_errors(func: CallableT) -> CallableT:
|
||||
@wraps(func)
|
||||
def wrapped(*args: Any, **kwargs: Any) -> Any:
|
||||
if not settings.TEST_SUITE and STRIPE_PUBLISHABLE_KEY is None:
|
||||
# Dev-only message; no translation needed.
|
||||
raise StripeError(
|
||||
"Missing Stripe config. See https://zulip.readthedocs.io/en/latest/subsystems/billing.html.")
|
||||
|
||||
if not Plan.objects.exists():
|
||||
# Dev-only message; no translation needed.
|
||||
raise StripeError(
|
||||
"Plan objects not created. Please run ./manage.py setup_stripe")
|
||||
if settings.DEVELOPMENT and not settings.TEST_SUITE: # nocoverage
|
||||
if STRIPE_PUBLISHABLE_KEY is None:
|
||||
raise AssertionError(
|
||||
"Missing Stripe config. "
|
||||
"See https://zulip.readthedocs.io/en/latest/subsystems/billing.html.")
|
||||
if not Plan.objects.exists():
|
||||
raise AssertionError(
|
||||
"Plan objects not created. Please run ./manage.py setup_stripe")
|
||||
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user