diff --git a/pagure/api/__init__.py b/pagure/api/__init__.py index 2d18237..0cff249 100644 --- a/pagure/api/__init__.py +++ b/pagure/api/__init__.py @@ -36,7 +36,7 @@ class APIERROR(enum.Enum): EINVALIDTOK = 'Invalid or expired token. Please visit %s to get or '\ 'renew your API token.' % APP.config['APP_URL'] ENOISSUE = 'Issue not found' - EISSUEREST = 'You are not allowed to view this issue' + EISSUENOTALLOWED = 'You are not allowed to view this issue' EPULLREQUESTSDISABLED = 'Pull-Request have been deactivated for this '\ 'project' ENOREQ = 'Pull-Request not found' diff --git a/pagure/api/issue.py b/pagure/api/issue.py index 74fd5c0..a1212db 100644 --- a/pagure/api/issue.py +++ b/pagure/api/issue.py @@ -366,7 +366,8 @@ def api_view_issue(repo, issueid, username=None): if issue.private and not is_repo_admin(repo) \ and (not authenticated() or not issue.user.user == flask.g.fas_user.username): - raise pagure.exceptions.APIError(403, error_code=APIERROR.EISSUEREST) + raise pagure.exceptions.APIError( + 403, error_code=APIERROR.EISSUENOTALLOWED) jsonout = flask.jsonify(issue.to_json(public=True)) return jsonout @@ -422,7 +423,8 @@ def api_change_status_issue(repo, issueid, username=None): if issue.private and not is_repo_admin(repo) \ and (not authenticated() or not issue.user.user == flask.g.fas_user.username): - raise pagure.exceptions.APIError(403, error_code=APIERROR.EISSUEREST) + raise pagure.exceptions.APIError( + 403, error_code=APIERROR.EISSUENOTALLOWED) status = pagure.lib.get_issue_statuses(SESSION) form = pagure.forms.StatusForm(status=status, csrf_enabled=False) @@ -506,7 +508,8 @@ def api_comment_issue(repo, issueid, username=None): if issue.private and not is_repo_admin(repo) \ and (not authenticated() or not issue.user.user == flask.g.fas_user.username): - raise pagure.exceptions.APIError(403, error_code=APIERROR.EISSUEREST) + raise pagure.exceptions.APIError( + 403, error_code=APIERROR.EISSUENOTALLOWED) form = pagure.forms.CommentForm(csrf_enabled=False) if form.validate_on_submit(): diff --git a/tests/test_progit_flask_api_issue.py b/tests/test_progit_flask_api_issue.py index 67234b4..008fdcc 100644 --- a/tests/test_progit_flask_api_issue.py +++ b/tests/test_progit_flask_api_issue.py @@ -418,7 +418,7 @@ class PagureFlaskApiIssuetests(tests.Modeltests): data, { "error": "You are not allowed to view this issue", - "error_code": "EISSUEREST", + "error_code": "EISSUENOTALLOWED", } ) @@ -432,7 +432,7 @@ class PagureFlaskApiIssuetests(tests.Modeltests): data, { "error": "You are not allowed to view this issue", - "error_code": "EISSUEREST", + "error_code": "EISSUENOTALLOWED", } ) @@ -639,7 +639,7 @@ class PagureFlaskApiIssuetests(tests.Modeltests): data, { "error": "You are not allowed to view this issue", - "error_code": "EISSUEREST", + "error_code": "EISSUENOTALLOWED", } ) @@ -811,7 +811,7 @@ class PagureFlaskApiIssuetests(tests.Modeltests): data, { "error": "You are not allowed to view this issue", - "error_code": "EISSUEREST", + "error_code": "EISSUENOTALLOWED", } )