billing: Improve error message for require_billing_access.

This commit is contained in:
Rishi Gupta 2018-11-01 14:17:36 -07:00
parent 4533f8f962
commit 7dc021a6b2
2 changed files with 2 additions and 2 deletions

View File

@ -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'))

View File

@ -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