From 577c5508218de24094ac1d6ab2189b9cac4b086b Mon Sep 17 00:00:00 2001 From: Kirill Zaitsev Date: Mon, 2 Nov 2015 18:25:53 +0300 Subject: [PATCH] Use detail instead of explanation for 415 errors As of webob 1.5.1 415 exception does not have explanation in it's template. 'detail' is present in both versions templates. Also adds CONTENT_TYPE to test-requests environment, to allow tests to run correctly. Change-Id: I52f2686ee838eef38ea9c5f48fe5f9e093e82412 Partial-Bug: #1512390 --- murano/common/wsgi.py | 2 +- murano/tests/unit/api/base.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/murano/common/wsgi.py b/murano/common/wsgi.py index d127fbe31..76f6329dc 100644 --- a/murano/common/wsgi.py +++ b/murano/common/wsgi.py @@ -404,7 +404,7 @@ class Resource(object): action, action_args, accept = self.deserialize_request(request) except exceptions.UnsupportedContentType: msg = _("Unsupported Content-Type") - return webob.exc.HTTPUnsupportedMediaType(explanation=msg) + return webob.exc.HTTPUnsupportedMediaType(detail=msg) except exceptions.MalformedRequestBody: msg = _("Malformed request body") return webob.exc.HTTPBadRequest(explanation=msg) diff --git a/murano/tests/unit/api/base.py b/murano/tests/unit/api/base.py index 3b8ebd0ad..4c5894fd5 100644 --- a/murano/tests/unit/api/base.py +++ b/murano/tests/unit/api/base.py @@ -147,6 +147,7 @@ class ControllerTest(object): 'PATH_INFO': path, 'wsgi.url_scheme': 'http', 'QUERY_STRING': '', + 'CONTENT_TYPE': 'application/json', } def _simple_request(self, path, params=None, method='GET',