diff --git a/endpoints/appr/decorators.py b/endpoints/appr/decorators.py index 5d6e78589..2de588055 100644 --- a/endpoints/appr/decorators.py +++ b/endpoints/appr/decorators.py @@ -2,10 +2,10 @@ import logging from functools import wraps -from flask import abort - from data import model +from util.http import abort + logger = logging.getLogger(__name__) @@ -26,7 +26,7 @@ def disallow_for_image_repository(get_reponame_method=_get_reponame_kwargs): image_repo = model.repository.get_repository(namespace_name, repo_name, kind_filter='image') if image_repo is not None: logger.debug('Tried to invoked a CNR method on an image repository') - abort(501) + abort(405, message='Cannot push an application to an image repository with the same name') return func(*args, **kwargs) return wrapped return wrapper diff --git a/endpoints/appr/test/test_appr_decorators.py b/endpoints/appr/test/test_appr_decorators.py index fee7ea7cb..c71b3107c 100644 --- a/endpoints/appr/test/test_appr_decorators.py +++ b/endpoints/appr/test/test_appr_decorators.py @@ -1,6 +1,6 @@ import pytest -from werkzeug.exceptions import NotImplemented as NIE +from werkzeug.exceptions import HTTPException from data import model from endpoints.appr import require_app_repo_read @@ -14,6 +14,6 @@ def test_require_app_repo_read(app): def empty(**kwargs): called[0] = True - with pytest.raises(NIE): + with pytest.raises(HTTPException): empty(namespace='devtable', package_name='simple') assert not called[0]