From fe15769b277bb2a7107de4317057537a9b322fae 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 e6587a1ea..f39f3bcc0 100644 --- a/murano/common/wsgi.py +++ b/murano/common/wsgi.py @@ -410,7 +410,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',