From 7dc021a6b26cbbba44da4785b48cfbcda24fbd04 Mon Sep 17 00:00:00 2001 From: Rishi Gupta Date: Thu, 1 Nov 2018 14:17:36 -0700 Subject: [PATCH] billing: Improve error message for require_billing_access. --- corporate/tests/test_stripe.py | 2 +- zerver/decorator.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py index 783de3fdc4..5d96cc6347 100644 --- a/corporate/tests/test_stripe.py +++ b/corporate/tests/test_stripe.py @@ -710,7 +710,7 @@ class RequiresBillingAccessTest(ZulipTestCase): # Normal users do not have access self.login(self.example_email('cordelia')) response = self.client_post(url, request_data) - self.assert_json_error_contains(response, "Access denied") + self.assert_json_error_contains(response, "Must be a billing administrator or an organization") # Billing admins have access self.login(self.example_email('hamlet')) diff --git a/zerver/decorator.py b/zerver/decorator.py index 1bf737223c..394aba6eb6 100644 --- a/zerver/decorator.py +++ b/zerver/decorator.py @@ -139,7 +139,7 @@ def require_billing_access(func: ViewFuncT) -> ViewFuncT: @wraps(func) def wrapper(request: HttpRequest, user_profile: UserProfile, *args: Any, **kwargs: Any) -> HttpResponse: if not user_profile.is_realm_admin and not user_profile.is_billing_admin: - raise JsonableError(_("Access denied")) + raise JsonableError(_("Must be a billing administrator or an organization administrator")) return func(request, user_profile, *args, **kwargs) return wrapper # type: ignore # https://github.com/python/mypy/issues/1927